diff options
| author | Paul Buetow <paul@buetow.org> | 2011-08-07 11:43:28 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2011-08-07 11:43:28 +0000 |
| commit | 540230a24069f96d55ddb7b82c3a680a739f7ee3 (patch) | |
| tree | 6d989c94b585b601187ea279a922de33a1631f90 | |
| parent | 6833b5bcb7cc9cb57a6f15b3b0c872470aee01b6 (diff) | |
Fixed a bug in $barnum
| -rwxr-xr-x | loadbars.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/loadbars.pl b/loadbars.pl index 82cc552..c650bd3 100755 --- a/loadbars.pl +++ b/loadbars.pl @@ -342,6 +342,7 @@ sub main_loop ($@) { my %is_host_summary; my $new_num_stats = keys %CPUSTATS; + if ($new_num_stats != $num_stats) { %prev_stats = (); %last_loads = (); @@ -351,8 +352,7 @@ sub main_loop ($@) { } # Avoid division by null - my $div = $num_stats; - my $width = $CONF{width} / ($div ? $div : 1); + my $width = $CONF{width} / ($num_stats ? $num_stats : 1); my $barnum = -1; for my $key (sort keys %CPUSTATS) { |
