summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcpuload.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpuload.pl b/cpuload.pl
index 42d4399..9d31388 100755
--- a/cpuload.pl
+++ b/cpuload.pl
@@ -124,7 +124,10 @@ sub graph_stats ($$) {
my %last_loads;
loop {
- my $width = WIDTH / (keys %STATS) - 1;
+ my $width = do {
+ sleep 1 until %STATS;
+ WIDTH / (keys %STATS) - 1
+ };
my ($x, $y) = (0, 0);
for my $key (sort keys %STATS) {