X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=gearman-top.pl;h=9670670fbe9a704ae133601b1946e14052d346d3;hb=e2364b6f29af230d5ee3db03c8bd15de1c6fd9da;hp=7bb4dbc9bad8eda51c638d8c1718896eddd59a9b;hpb=028ef18ea0f6bddb6de47ebfcea894cdb93b586b;p=cloudstore.git diff --git a/gearman-top.pl b/gearman-top.pl index 7bb4dbc..9670670 100755 --- a/gearman-top.pl +++ b/gearman-top.pl @@ -16,18 +16,21 @@ print ""; # Erase Screen my $t = time(); my $max; my $erase_screen = 1; -my $last_names = '?'; +my $last_content = '?'; while(1) { my $uptime = time() - $t; - print "" if $erase_screen || $uptime % 5 == 0; + if ( $erase_screen ) { + print ""; + $erase_screen = 0; + } print ""; # Cursor Home print "Gearman " . localtime(time()) . "\tmax update: $uptime\n"; printf "queued running wrk function\n"; print $sock "STATUS\n"; - my $names; + my $content; while ( my $line = <$sock> ) { chomp $line; @@ -38,13 +41,14 @@ while(1) { $max->{$name}->{$_} ||= 0 foreach qw(queued running); $max->{$name}->{queued} = $queued if $queued > $max->{$name}->{queued}; $max->{$name}->{running} = $running if $running > $max->{$name}->{running}; - printf "%3d %-3d %3d %-3d %3d %s\n" + my $line = sprintf "%3d %-3d %3d %-3d %3d %s" , $queued, $max->{$name}->{queued} , $running, $max->{$name}->{running} , $workers , $name ; - $names .= $name; + print "$line\n"; + $content .= $line; } =for workers @@ -57,9 +61,9 @@ while(1) { } =cut - if ( $names ne $last_names ) { + if ( $content ne $last_content ) { $erase_screen = 1; - $last_names = $names; + $last_content = $content; } sleep 1;