| Filename | /2home/ss5/local/projects/Tapper/src/Tapper-MCP/lib/Tapper/MCP/Scheduler/PrioQueue.pm |
| Statements | Executed 3358 statements in 19.3ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 477 | 1 | 1 | 17.2ms | 1.25s | Tapper::MCP::Scheduler::PrioQueue::get_first_fitting |
| 477 | 1 | 1 | 12.3ms | 200ms | Tapper::MCP::Scheduler::PrioQueue::get_testrequests |
| 1 | 1 | 1 | 180µs | 311µs | Tapper::MCP::Scheduler::PrioQueue::BEGIN@5 |
| 1 | 1 | 1 | 23µs | 130µs | Tapper::MCP::Scheduler::PrioQueue::BEGIN@5.8 |
| 1 | 1 | 1 | 19µs | 6.61ms | Tapper::MCP::Scheduler::PrioQueue::BEGIN@6 |
| 1 | 1 | 1 | 13µs | 53µs | Tapper::MCP::Scheduler::PrioQueue::BEGIN@8 |
| 1 | 1 | 1 | 11µs | 27µs | Tapper::MCP::Scheduler::PrioQueue::BEGIN@37 |
| 1 | 1 | 1 | 10µs | 130ms | Tapper::MCP::Scheduler::PrioQueue::BEGIN@9 |
| 0 | 0 | 0 | 0s | 0s | Tapper::MCP::Scheduler::PrioQueue::_max_seq |
| 0 | 0 | 0 | 0s | 0s | Tapper::MCP::Scheduler::PrioQueue::add |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ## no critic (RequireUseStrict) | ||||
| 2 | package Tapper::MCP::Scheduler::PrioQueue; | ||||
| 3 | # ABSTRACT: Object for test queue abstraction | ||||
| 4 | |||||
| 5 | 6 | 210µs | 3 | 549µ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 # 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 |
| 6 | 3 | 75µs | 2 | 13.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 # 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 | |||||
| 8 | 3 | 27µs | 2 | 93µ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 # spent 53µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@8
# spent 40µs making 1 call to Exporter::import |
| 9 | 3 | 167µs | 2 | 130ms | # 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 # 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 | ||||
| 35 | 1431 | 10.2ms | my ($self) = @_; | ||
| 36 | |||||
| 37 | 3 | 148µs | 2 | 43µ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 # spent 27µs making 1 call to Tapper::MCP::Scheduler::PrioQueue::BEGIN@37
# spent 16µs making 1 call to strict::unimport |
| 38 | 1431 | 181ms | 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 | ); | ||||
| 46 | 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 | ||||
| 50 | 1908 | 8.50ms | my ($self, $free_hosts) = @_; | ||
| 51 | |||||
| 52 | 477 | 200ms | my $jobs = $self->get_testrequests; # spent 200ms making 477 calls to Tapper::MCP::Scheduler::PrioQueue::get_testrequests, avg 420µs/call | ||
| 53 | 477 | 1.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 | } | ||||
| 65 | return; | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | 1 | 2µs | 1; | ||
| 69 | |||||
| 70 | __END__ |