From b63d544551b722387129f9c0232f9060f2d30588 Mon Sep 17 00:00:00 2001 From: presbrey Date: Thu, 11 Apr 2013 18:31:05 -0300 Subject: [PATCH] fix cpu_by_process time parser cumulated CPU time is in [DD-]hh:mm:ss format --- plugins/system/cpu_by_process | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/system/cpu_by_process b/plugins/system/cpu_by_process index 93916dc0..98b066ad 100755 --- a/plugins/system/cpu_by_process +++ b/plugins/system/cpu_by_process @@ -60,7 +60,12 @@ while () $process =~ tr|a-zA-Z0-9|_|c; my @times = split /:/, $cputime; - $cputime = (($times[0] * 60) + $times[1]) * 60 + $times[2]; + my @days = split /-/, $times[0]; + if ($days[1]) { + $cputime = ((($days[0] * 24) + $days[1]) * 60 + $times[1]) * 60 + $times[2]; + } else { + $cputime = (($times[0] * 60) + $times[1]) * 60 + $times[2]; + } $total_cpu_by_process{$process} += $cputime; }