Skip Menu |
 

This queue is for tickets about the Proc-ProcessTable CPAN distribution.

Report information
The Basics
Id: 124402
Status: open
Priority: 0/
Queue: Proc-ProcessTable

People
Owner: Nobody in particular
Requestors: frank [...] digennaro.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: pctcpu sometimes returns "Inf"
Download (untitled) / with headers
text/plain 428b
Hello; I am using Proc-ProcessTable-0.55 on multiple Linux platforms (mostly CentOS and Ubuntu) and am seeing an unknown return value only for 'pctcpu'. It may not be a bug in this Perl module, and maybe Linux is accurately reporting this, but I'm getting a value of 'Inf' for 'pctcpu' a significant percentage of the time. Has anyone seen this behavior before? Any insight at all would be greatly appreciated. Thanks; Frank
Download (untitled) / with headers
text/plain 1.4k
Hi Frank, this is actually a tricky one. I think it is not a bug of Proc::ProcessTable. It has more to do with "How to calculate the CPU usage?". Here is more information: https://unix.stackexchange.com/questions/58539/top-and-ps-not-showing-the-same-cpu-result/58541#58541 https://stackoverflow.com/questions/16726779/how-do-i-get-the-total-cpu-usage-of-an-application-from-proc-pid-stat So basically, the pctcpu value is always wrong. Similar to the ps command. To do it right, I _tried_ to create an example, see here: https://github.com/jwbargsten/perl-proc-processtable/blob/master/contrib/pctcpu_example.pl The idea is to create a time window in which you measure the used cpu time of a process. This you have to divide by the elapsed time. The example is a little bit more sophisticated than it needs to be, it implements a "moving average". This should come quite close to what you see in (h)top. I hope this helps. Cheers, Joachim Am Mo 12. Feb 2018, 12:58:58, cbbs70a schrieb: Show quoted text
> Hello; > I am using Proc-ProcessTable-0.55 on multiple Linux platforms > (mostly CentOS and Ubuntu) and am seeing an unknown return value only > for 'pctcpu'. It may not be a bug in this Perl module, and maybe Linux > is accurately reporting this, but I'm getting a value of 'Inf' for > 'pctcpu' a significant percentage of the time. Has anyone seen this > behavior before? Any insight at all would be greatly appreciated. > Thanks; > Frank


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.