projects
/
cloudstore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
better check of md5sum files
[cloudstore.git]
/
gearman-top.pl
diff --git
a/gearman-top.pl
b/gearman-top.pl
index
e69d36f
..
9670670
100755
(executable)
--- a/
gearman-top.pl
+++ b/
gearman-top.pl
@@
-15,16
+15,23
@@
print "
\e
[2J"; # Erase Screen
my $t = time();
my $max;
my $t = time();
my $max;
+my $erase_screen = 1;
+my $last_content = '?';
while(1) {
my $uptime = time() - $t;
while(1) {
my $uptime = time() - $t;
- print "
\e
[2J" if $uptime % 5 == 0;
+ if ( $erase_screen ) {
+ print "
\e
[2J";
+ $erase_screen = 0;
+ }
print "
\e
[0;0H"; # Cursor Home
print "Gearman " . localtime(time()) . "\t
\e
[34mmax update: $uptime
\e
[0m\n";
printf "
\e
[4mqueued running wrk function
\e
[0m\n";
print $sock "STATUS\n";
print "
\e
[0;0H"; # Cursor Home
print "Gearman " . localtime(time()) . "\t
\e
[34mmax update: $uptime
\e
[0m\n";
printf "
\e
[4mqueued running wrk function
\e
[0m\n";
print $sock "STATUS\n";
+ my $content;
+
while ( my $line = <$sock> ) {
chomp $line;
# warn "# [$line]\n";
while ( my $line = <$sock> ) {
chomp $line;
# warn "# [$line]\n";
@@
-34,12
+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};
$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
\e
[34m%-3d
\e
[0m %3d
\e
[34m%-3d
\e
[0m %3d %s\n
"
+
my $line = sprintf "%3d
\e
[34m%-3d
\e
[0m %3d
\e
[34m%-3d
\e
[0m %3d %s
"
, $queued, $max->{$name}->{queued}
, $running, $max->{$name}->{running}
, $workers
, $name
;
, $queued, $max->{$name}->{queued}
, $running, $max->{$name}->{running}
, $workers
, $name
;
+ print "$line\n";
+ $content .= $line;
}
=for workers
}
=for workers
@@
-52,5
+61,10
@@
while(1) {
}
=cut
}
=cut
+ if ( $content ne $last_content ) {
+ $erase_screen = 1;
+ $last_content = $content;
+ }
+
sleep 1;
}
sleep 1;
}