6 use Data::Dump qw(dump);
8 my $sock = IO::Socket::INET->new(
9 PeerAddr => '127.0.0.1',
14 print "
\e[2J"; # Erase Screen
22 my $uptime = time() - $t;
23 print "
\e[2J" if $erase_screen || $uptime % 5 == 0;
24 print "
\e[0;0H"; # Cursor Home
25 print "Gearman " . localtime(time()) . "\t
\e[34mmax update: $uptime
\e[0m\n";
26 printf "
\e[4mqueued running wrk function
\e[0m\n";
28 print $sock "STATUS\n";
32 while ( my $line = <$sock> ) {
36 next if $line =~ m/\t0$/; # ignore functions which don't have active workers
37 my ( $name, $queued, $running, $workers ) = split(/\t/,$line,4);
38 $max->{$name}->{$_} ||= 0 foreach qw(queued running);
39 $max->{$name}->{queued} = $queued if $queued > $max->{$name}->{queued};
40 $max->{$name}->{running} = $running if $running > $max->{$name}->{running};
41 printf "%3d
\e[34m%-3d
\e[0m %3d
\e[34m%-3d
\e[0m %3d %s\n"
42 , $queued, $max->{$name}->{queued}
43 , $running, $max->{$name}->{running}
51 print $sock "WORKERS\n";
53 while ( my $line = <$sock> ) {
60 if ( $names ne $last_names ) {