Fix to skip CPU IO in initial load

This commit is contained in:
iliajie
2023-03-04 20:20:49 +02:00
parent fe8bcba3a4
commit 682399997f
2 changed files with 7 additions and 3 deletions

View File

@@ -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 '');

View File

@@ -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 ];
}