Profile of lib/Tapper/MCP/Scheduler/Algorithm/WFQ.pm

← 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:06 2012

Filename | /2home/ss5/local/projects/Tapper/src/Tapper-MCP/lib/Tapper/MCP/Scheduler/Algorithm/WFQ.pm
Statements | Executed 14491 statements in 22.3ms

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
477 | 1 | 1 | 13.3ms | 48.1ms | Tapper::MCP::Scheduler::Algorithm::WFQ::::lookup_next_queueTapper::MCP::Scheduler::Algorithm::WFQ::lookup_next_queue
1448 | 1 | 1 | 9.83ms | 23.8ms | Tapper::MCP::Scheduler::Algorithm::WFQ::::get_virtual_finishing_timeTapper::MCP::Scheduler::Algorithm::WFQ::get_virtual_finishing_time
109 | 1 | 1 | 3.60ms | 12.0s | Tapper::MCP::Scheduler::Algorithm::WFQ::::update_queueTapper::MCP::Scheduler::Algorithm::WFQ::update_queue
1 | 1 | 1 | 54µs | 107µs | Tapper::MCP::Scheduler::Algorithm::WFQ::::BEGIN@6Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6
1 | 1 | 1 | 25µs | 2.91ms | Tapper::MCP::Scheduler::Algorithm::WFQ::::BEGIN@5Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@5
1 | 1 | 1 | 9µs | 53µs | Tapper::MCP::Scheduler::Algorithm::WFQ::::BEGIN@6.16Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6.16
0 | 0 | 0 | 0s | 0s | Tapper::MCP::Scheduler::Algorithm::WFQ::::get_next_queueTapper::MCP::Scheduler::Algorithm::WFQ::get_next_queue

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)
2 |  |  |  |  | package Tapper::MCP::Scheduler::Algorithm::WFQ;
3 |  |  |  |  | # ABSTRACT: Scheduling algorithm "Weighted Fair Queueing"
4 |  |  |  |  |
5 | 3 | 53µs | 2 | 5.79ms | # spent 2.91ms (25µs+2.88) within Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@5 which was called: # once (25µs+2.88ms) by main::BEGIN@1.15 at line 5 use Moose::Role; # spent 2.91ms making 1 call to Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@5 # spent 2.88ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:492]
6 | 6 | 308µs | 3 | 203µs | # spent 107µs (54+53) within Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6 which was called: # once (54µs+53µs) by main::BEGIN@1.15 at line 6 # spent 53µs (9+43) within Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6.16 which was called: # once (9µs+43µs) by Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6 at line 6 use 5.010; # spent 107µs making 1 call to Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6 # spent 53µs making 1 call to Tapper::MCP::Scheduler::Algorithm::WFQ::BEGIN@6.16 # spent 44µs making 1 call to feature::import
7 | 1 | 2µs | 1 | 78µs | requires 'queues'; # spent 78µs making 1 call to Moose::Role::requires
8 |  |  |  |  |
9 |  |  |  |  | # use aliased 'Tapper::Schema::TestrunDB::Result::Queue';
10 |  |  |  |  |
11 |  |  |  |  | # spent 23.8ms (9.83+14.0) within Tapper::MCP::Scheduler::Algorithm::WFQ::get_virtual_finishing_time which was called 1448 times, avg 16µs/call: # 1448 times (9.83ms+14.0ms) by Tapper::MCP::Scheduler::Algorithm::WFQ::lookup_next_queue at line 30, avg 16µs/call sub get_virtual_finishing_time {
12 | 4344 | 8.20ms |  |  | my ($self, $queue) = @_;
13 |  |  |  |  |
14 |  |  | 1448 | 6.19ms | my $prio = $queue->priority || 1; # spent 6.19ms making 1448 calls to Tapper::Schema::TestrunDB::Result::Queue::priority, avg 4µs/call
15 |  |  | 1448 | 7.81ms | return ($queue->runcount + 1.0) / $prio; # spent 7.81ms making 1448 calls to Tapper::Schema::TestrunDB::Result::Queue::runcount, avg 5µs/call
16 |  |  |  |  | }
17 |  |  |  |  |
18 |  |  |  |  |
19 |  |  |  |  | # spent 48.1ms (13.3+34.7) within Tapper::MCP::Scheduler::Algorithm::WFQ::lookup_next_queue which was called 477 times, avg 101µs/call: # 477 times (13.3ms+34.7ms) by Tapper::MCP::Scheduler::Controller::get_next_job at line 93 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 101µs/call sub lookup_next_queue {
20 | 2385 | 2.98ms |  |  | my ($self, $queues) = @_;
21 |  |  |  |  |
22 |  |  |  |  | my $vft;
23 |  |  |  |  | my $queue;
24 |  |  |  |  |
25 |  |  |  |  | foreach my $q (values %$queues)
26 |  |  |  |  | {
27 | 5792 | 7.44ms |  |  | my $this_vft;
28 |  |  | 1448 | 10.9ms | next if not $q->priority; # spent 10.9ms making 1448 calls to Tapper::Schema::TestrunDB::Result::Queue::priority, avg 8µs/call
29 |  |  |  |  |
30 |  |  | 1448 | 23.8ms | $this_vft = $self->get_virtual_finishing_time($q); # spent 23.8ms making 1448 calls to Tapper::MCP::Scheduler::Algorithm::WFQ::get_virtual_finishing_time, avg 16µs/call
31 |  |  |  |  |
32 | 1632 | 535µs |  |  | if (not defined $vft)
33 |  |  |  |  | {
34 |  |  |  |  | $vft = $this_vft;
35 |  |  |  |  | $queue = $q;
36 |  |  |  |  | }
37 |  |  |  |  | elsif ($vft > $this_vft)
38 |  |  |  |  | {
39 |  |  |  |  | $vft = $this_vft;
40 |  |  |  |  | $queue = $q;
41 |  |  |  |  | }
42 |  |  |  |  | }
43 |  |  |  |  | return $queue;
44 |  |  |  |  | }
45 |  |  |  |  |
- - |  |  |  |  |
48 |  |  |  |  | sub get_next_queue
49 |  |  |  |  | {
50 |  |  |  |  | my ($self) = @_;
51 |  |  |  |  |
52 |  |  |  |  | my $vft;
53 |  |  |  |  | my $queue = $self->lookup_next_queue($self->queues);
54 |  |  |  |  | $self->update_queue($queue);
55 |  |  |  |  | return $queue;
56 |  |  |  |  | }
57 |  |  |  |  |
58 |  |  |  |  | # spent 12.0s (3.60ms+12.0) within Tapper::MCP::Scheduler::Algorithm::WFQ::update_queue which was called 109 times, avg 110ms/call: # 109 times (3.60ms+12.0s) by Tapper::MCP::Scheduler::Controller::get_next_job at line 107 of lib/Tapper/MCP/Scheduler/Controller.pm, avg 110ms/call sub update_queue {
59 | 327 | 2.81ms |  |  | my ($self, $q) = @_;
60 |  |  |  |  |
61 |  |  | 218 | 42.6ms | $q->runcount ( $q->runcount + 1 ); # spent 42.6ms making 218 calls to Tapper::Schema::TestrunDB::Result::Queue::runcount, avg 195µs/call
62 |  |  | 109 | 12.0s | $q->update; # spent 12.0s making 109 calls to DBIx::Class::Relationship::CascadeActions::update, avg 110ms/call
63 |  |  |  |  | }
64 |  |  |  |  |
65 | 1 | 4µs |  |  | 1;
66 |  |  |  |  |
67 |  |  |  |  | __END__