← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:22:37 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Tapper/Schema/TestrunDB/ResultSet/Testrun.pm
StatementsExecuted 16 statements in 585µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112.2ms91.0msTapper::Schema::TestrunDB::ResultSet::Testrun::::BEGIN@12Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12
11112µs66µsTapper::Schema::TestrunDB::ResultSet::Testrun::::BEGIN@15Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15
11110µs10µsTapper::Schema::TestrunDB::ResultSet::Testrun::::BEGIN@2Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@2
1119µs11µsTapper::Schema::TestrunDB::ResultSet::Testrun::::BEGIN@9Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9
1117µs17µsTapper::Schema::TestrunDB::ResultSet::Testrun::::BEGIN@10Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::addTapper::Schema::TestrunDB::ResultSet::Testrun::add
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::all_testrunsTapper::Schema::TestrunDB::ResultSet::Testrun::all_testruns
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::due_testrunsTapper::Schema::TestrunDB::ResultSet::Testrun::due_testruns
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::finished_testrunsTapper::Schema::TestrunDB::ResultSet::Testrun::finished_testruns
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::queued_testrunsTapper::Schema::TestrunDB::ResultSet::Testrun::queued_testruns
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::running_testrunsTapper::Schema::TestrunDB::ResultSet::Testrun::running_testruns
0000s0sTapper::Schema::TestrunDB::ResultSet::Testrun::::statusTapper::Schema::TestrunDB::ResultSet::Testrun::status
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Tapper::Schema::TestrunDB::ResultSet::Testrun;
2
# spent 10µs within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@2 which was called: # once (10µs+0s) by Class::C3::Componentised::ensure_class_loaded at line 4
BEGIN {
315µs $Tapper::Schema::TestrunDB::ResultSet::Testrun::AUTHORITY = 'cpan:AMD';
4122µs110µs}
5{
621µs $Tapper::Schema::TestrunDB::ResultSet::Testrun::VERSION = '0.001';
7}
8
9318µs213µs
# spent 11µs (9+2) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9 which was called: # once (9µs+2µs) by Class::C3::Componentised::ensure_class_loaded at line 9
use strict;
# spent 11µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@9 # spent 2µs making 1 call to strict::import
10321µs226µs
# spent 17µs (7+9) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10 which was called: # once (7µs+9µs) by Class::C3::Componentised::ensure_class_loaded at line 10
use warnings;
# spent 17µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@10 # spent 9µs making 1 call to warnings::import
11
123115µs191.0ms
# spent 91.0ms (12.2+78.8) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 which was called: # once (12.2ms+78.8ms) by Class::C3::Componentised::ensure_class_loaded at line 12
use DateTime;
13
14
153400µs2120µs
# spent 66µs (12+54) within Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15 which was called: # once (12µs+54µs) by Class::C3::Componentised::ensure_class_loaded at line 15
use parent 'DBIx::Class::ResultSet';
# spent 66µs making 1 call to Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@15 # spent 54µs making 1 call to parent::import
16
17
18sub queued_testruns
19{
20 shift->search({
21 starttime_testrun => undef,
22 }
23 );
24}
25
26
27sub running_testruns
28{
29 shift->search({
30 starttime_testrun => { '!=' => undef },
31 endtime_test_program => undef,
32 }
33 );
34}
35
36
37sub finished_testruns
38{
39 shift->search({
40 endtime_test_program => { '!=' => undef },
41 }
42 );
43}
44
45
46sub due_testruns
47{
48 my ($self) = @_;
49
50 my $now = $self->result_source->storage->datetime_parser->format_datetime(DateTime->now);
51 return $self->search(
52 {
53 starttime_earliest => { '<', $now},
54 starttime_testrun => undef,
55 },
56 {
57 order_by => [qw/starttime_earliest/]
58 }
59 );
60}
61
62
63sub all_testruns {
64 shift->search({});
65}
66
67
68sub status {
69 shift->search({'testrun_scheduling.status' => $_[0]}, {join => 'testrun_scheduling'});
70}
71
72
73sub add {
74 my ($self, $args) = @_;
75
76 my $testrun = $self->new
77 ({
78 testplan_id => $args->{testplan_id},
79 notes => $args->{notes},
80 shortname => $args->{shortname},
81 topic_name => $args->{topic_name},
82 starttime_earliest => $args->{earliest},
83 owner_user_id => $args->{owner_user_id},
84 rerun_on_error => $args->{rerun_on_error},
85 });
86
87 $testrun->insert;
88
89
90 my $testrunscheduling = $self->result_source->schema->resultset('TestrunScheduling')->new
91 ({
92 testrun_id => $testrun->id,
93 queue_id => $args->{queue_id},
94 host_id => $args->{host_id},
95 status => "schedule",
96 auto_rerun => $args->{auto_rerun} || 0,
97 });
98 if ($args->{priority}) {
99 $testrunscheduling->prioqueue_seq($self->result_source->schema->resultset('TestrunScheduling')->max_priority_seq()+1);
100 }
101
102 $testrunscheduling->insert;
103
104 if ($args->{scenario_id}) {
105 my $scenario_element = $self->result_source->schema->resultset('ScenarioElement')->new
106 ({
107 scenario_id => $args->{scenario_id},
108 testrun_id => $testrun->id,
109 });
110 $scenario_element->insert;
111 }
112
113 foreach my $host_id(@{$args->{requested_host_ids}}) {
114 my $requested_host = $self->result_source->schema->resultset('TestrunRequestedHost')->new
115 ({
116 host_id => $host_id,
117 testrun_id => $testrun->id,
118 });
119 $requested_host->insert;
120 }
121
122 return $testrun->id;
123}
124
12513µs1;
126
127__END__