From 682399997f01ea436b0798d6615617821811a166 Mon Sep 17 00:00:00 2001 From: iliajie Date: Sat, 4 Mar 2023 20:20:49 +0200 Subject: [PATCH] Fix to skip CPU IO in initial load --- proc/linux-lib.pl | 8 ++++++-- system-status/system-status-lib.pl | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/proc/linux-lib.pl b/proc/linux-lib.pl index 79c534fc1..fe865dcda 100755 --- a/proc/linux-lib.pl +++ b/proc/linux-lib.pl @@ -655,9 +655,13 @@ return (\@cpu, \@fans); # blocks in and out sub get_cpu_io_usage { -my $out,@lines,@w; +my ($nodelay) = @_; +my $interval; +$interval = " 1 2" + if (!$nodelay); +my ($out, @lines, @w); if (&has_command("vmstat")) { - $out = &backquote_command("vmstat 1 2 2>/dev/null"); + $out = &backquote_command("vmstat$interval 2>/dev/null"); @lines = split(/\r?\n/, $out); @w = split(/\s+/, $lines[$#lines]); shift(@w) if ($w[0] eq ''); diff --git a/system-status/system-status-lib.pl b/system-status/system-status-lib.pl index 2df92a54c..f35e6c6aa 100755 --- a/system-status/system-status-lib.pl +++ b/system-status/system-status-lib.pl @@ -84,7 +84,7 @@ $info->{'drivetemps'} = \@drive if (@drive); # IO input and output if (defined(&proc::get_cpu_io_usage)) { my ($user, $kernel, $idle, $io, $vm, $bin, $bout) = - &proc::get_cpu_io_usage(); + &proc::get_cpu_io_usage((&indexof('cpuio', @{$modskip}) > -1)); if (defined($bin)) { $info->{'io'} = [ $bin, $bout ]; }