← 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:23:44 2012

Filename/2home/ss5/local/projects/Tapper/src/Tapper-MCP/lib/Tapper/MCP/Scheduler/PrioQueue.pm
StatementsExecuted 3358 statements in 19.3ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
4771117.2ms1.25sTapper::MCP::Scheduler::PrioQueue::::get_first_fittingTapper::MCP::Scheduler::PrioQueue::get_first_fitting
4771112.3ms200msTapper::MCP::Scheduler::PrioQueue::::get_testrequestsTapper::MCP::Scheduler::PrioQueue::get_testrequests
111180µs311µsTapper::MCP::Scheduler::PrioQueue::::BEGIN@5Tapper::MCP::Scheduler::PrioQueue::BEGIN@5
11123µs130µsTapper::MCP::Scheduler::PrioQueue::::BEGIN@5.8Tapper::MCP::Scheduler::PrioQueue::BEGIN@5.8
11119µs6.61msTapper::MCP::Scheduler::PrioQueue::::BEGIN@6Tapper::MCP::Scheduler::PrioQueue::BEGIN@6
11113µs53µsTapper::MCP::Scheduler::PrioQueue::::BEGIN@8Tapper::MCP::Scheduler::PrioQueue::BEGIN@8
11111µs27µsTapper::MCP::Scheduler::PrioQueue::::BEGIN@37Tapper::MCP::Scheduler::PrioQueue::BEGIN@37
11110µs130msTapper::MCP::Scheduler::PrioQueue::::BEGIN@9Tapper::MCP::Scheduler::PrioQueue::BEGIN@9
0000s0sTapper::MCP::Scheduler::PrioQueue::::_max_seqTapper::MCP::Scheduler::PrioQueue::_max_seq
0000s0sTapper::MCP::Scheduler::PrioQueue::::addTapper::MCP::Scheduler::PrioQueue::add
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1## no critic (RequireUseStrict)
2package Tapper::MCP::Scheduler::PrioQueue;
3# ABSTRACT: Object for test queue abstraction
4
56210µs3549µs
# spent 130µs (23+108) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@5.8 which was called: # once (23µs+108µs) by Tapper::MCP::Scheduler::PrioQueue::BEGIN@5 at line 5 # spent 311µs (180+131) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@5 which was called: # once (180µs+131µs) by Tapper::MCP::Scheduler::Controller::BEGIN@1.7 at line 5
use 5.010;
# spent 311µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@5 # spent 130µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@5.8 # spent 108µs making 1 call to feature::import
6375µs213.2ms
# spent 6.61ms (19µs+6.59) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@6 which was called: # once (19µs+6.59ms) by Tapper::MCP::Scheduler::Controller::BEGIN@1.7 at line 6
use Moose;
# spent 6.61ms making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@6 # spent 6.59ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492]
7
8327µs293µs
# spent 53µs (13+40) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@8 which was called: # once (13µs+40µs) by Tapper::MCP::Scheduler::Controller::BEGIN@1.7 at line 8
use Tapper::Model 'model';
# spent 53µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@8 # spent 40µs making 1 call to Exporter::import
93167µs2130ms
# spent 130ms (10µs+130) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@9 which was called: # once (10µs+130ms) by Tapper::MCP::Scheduler::Controller::BEGIN@1.7 at line 9
use aliased 'Tapper::Schema::TestrunDB::Result::TestrunScheduling';
# spent 130ms making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@9 # spent 130ms making 1 call to aliased::import, recursion: max depth 2, sum of overlapping time 130ms
10
11 sub _max_seq {
12 my ($self) = @_;
13
14 my $job_with_max_seq = model('TestrunDB')->resultset('TestrunScheduling')->search
15 (
16 { prioqueue_seq => { '>', 0 } },
17 {
18 select => [ { max => 'prioqueue_seq' } ],
19 as => [ 'max_seq' ], }
20 )->first;
21 return $job_with_max_seq->get_column('max_seq')
22 if $job_with_max_seq and defined $job_with_max_seq->get_column('max_seq');
23 return 0;
24 }
25
26 sub add {
27 my ($self, $job, $is_subtestrun) = @_;
28
29 my $max_seq = $self->_max_seq;
30 $job->prioqueue_seq($max_seq + 1);
31 $job->update;
32 }
33
34
# spent 200ms (12.3+188) within Tapper::MCP::Scheduler::PrioQueue::get_testrequests which was called 477 times, avg 420µs/call: # 477 times (12.3ms+188ms) by Tapper::MCP::Scheduler::PrioQueue::get_first_fitting at line 52, avg 420µs/call
sub get_testrequests {
35477368µs my ($self) = @_;
36
373148µs243µs
# spent 27µs (11+16) within Tapper::MCP::Scheduler::PrioQueue::BEGIN@37 which was called: # once (11µs+16µs) by Tapper::MCP::Scheduler::Controller::BEGIN@1.7 at line 37
no strict 'refs'; ## no critic (ProhibitNoStrict)
# spent 27µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@37 # spent 16µs making 1 call to strict::unimport
384778.21ms1431181ms my $testrequests_rs = model('TestrunDB')->resultset('TestrunScheduling')->search
# spent 106ms making 477 calls to DBIx::Class::Schema::resultset, avg 221µs/call # spent 72.6ms making 477 calls to DBIx::Class::ResultSet::search, avg 152µs/call # spent 3.04ms making 477 calls to Memoize::__ANON__[(eval 256)[Memoize.pm:71]:1], avg 6µs/call
39 ({
40 prioqueue_seq => { '>', 0 }
41 },
42 {
43 order_by => 'prioqueue_seq'
44 }
45 );
464771.61ms return $testrequests_rs;
47 }
48
49
# spent 1.25s (17.2ms+1.24) within Tapper::MCP::Scheduler::PrioQueue::get_first_fitting which was called 477 times, avg 2.63ms/call: # 477 times (17.2ms+1.24s) by Tapper::MCP::Scheduler::Controller::get_next_job at line 90 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 2.63ms/call
sub get_first_fitting {
50477691µs my ($self, $free_hosts) = @_;
51
524771.79ms477200ms my $jobs = $self->get_testrequests;
# spent 200ms making 477 calls to Tapper::MCP::Scheduler::PrioQueue::get_testrequests, avg 420µs/call
534771.85ms4771.03s while (my $job = $jobs->next()) {
# spent 1.03s making 477 calls to DBIx::Class::ResultSet::next, avg 2.17ms/call
54 if (my $host = $job->fits($free_hosts)) {
55 $job->host_id ($host->id);
56
57 if ($job->testrun->scenario_element) {
58 $job->testrun->scenario_element->is_fitted(1);
59 $job->testrun->scenario_element->update();
60 }
61
62 return $job;
63 }
64 }
654774.17ms return;
66 }
67
6812µs1;
69
70__END__