From 540230a24069f96d55ddb7b82c3a680a739f7ee3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 7 Aug 2011 11:43:28 +0000 Subject: Fixed a bug in $barnum --- loadbars.pl | 4 ++-- 1 file 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) { -- cgit v1.2.3