From 2f02dbd30cddc9a361b987e1288a2ac2e61c10c2 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 8 Oct 2015 13:17:20 +0200 Subject: [PATCH] fixed to avoid negative values in the network graph of the 'process' graph. #117 --- lib/process.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/process.pm b/lib/process.pm index 9077ba2..32a184e 100644 --- a/lib/process.pm +++ b/lib/process.pm @@ -211,8 +211,8 @@ sub process_update { my $v_mem = 0; my $rest; - # since a process name can include spaces, an 'split(' ', )' wouldn't work here. - # so we discard the first part of the process information (pid, comm and state) + # since a process name can include spaces an 'split(' ', )' wouldn't work here, + # therefore we discard the first part of the process information (pid, comm and state). (undef, $rest) = =~ m/^(\d+\s\(.*?\)\s\S\s)(.*?)$/; (undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $utime, $stime, undef, undef, undef, undef, $v_nth, undef, undef, undef, $v_mem) = split(' ', $rest); close(IN); @@ -255,6 +255,7 @@ sub process_update { $net = 0 unless $v_net != $net; $net /= 60; $config->{process_hist}->{$str} = $v_net; + $net = 0 if $net < 0; my $v_vcs = 0; my $v_ics = 0;