line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gearman::Starter::Util; |
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
106
|
|
3
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
773
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub display_scoreboard { |
6
|
0
|
|
|
0
|
0
|
|
my $scoreboard = shift; |
7
|
0
|
|
|
|
|
|
my $stats = $scoreboard->read_all; |
8
|
0
|
|
|
|
|
|
my $raw_stats; |
9
|
0
|
|
|
|
|
|
my $busy = 0; |
10
|
0
|
|
|
|
|
|
my $idle = 0; |
11
|
0
|
|
|
|
|
|
for my $pid ( sort { $a <=> $b } keys %$stats) { |
|
0
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
|
if ( $stats->{$pid} =~ m!^A! ) { |
13
|
0
|
|
|
|
|
|
$busy++; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
else { |
16
|
0
|
|
|
|
|
|
$idle++; |
17
|
|
|
|
|
|
|
} |
18
|
0
|
|
|
|
|
|
$raw_stats .= sprintf "%-14d %s\n", $pid, $stats->{$pid} |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
$raw_stats = <<"EOF"; |
21
|
|
|
|
|
|
|
BusyWorkers: $busy |
22
|
|
|
|
|
|
|
IdleWorkers: $idle |
23
|
|
|
|
|
|
|
-- |
24
|
|
|
|
|
|
|
pid Status Counter Comment |
25
|
|
|
|
|
|
|
$raw_stats |
26
|
|
|
|
|
|
|
EOF |
27
|
0
|
|
|
|
|
|
$raw_stats; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |