summaryrefslogtreecommitdiff
path: root/loadbars.pl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2011-08-07 11:43:28 +0000
committerPaul Buetow <paul@buetow.org>2011-08-07 11:43:28 +0000
commit540230a24069f96d55ddb7b82c3a680a739f7ee3 (patch)
tree6d989c94b585b601187ea279a922de33a1631f90 /loadbars.pl
parent6833b5bcb7cc9cb57a6f15b3b0c872470aee01b6 (diff)
Fixed a bug in $barnum
Diffstat (limited to 'loadbars.pl')
-rwxr-xr-xloadbars.pl4
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) {