You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. get any valid Process instance
2. call get_cpu_percent on this instance with interval == 0
3. value will be zero, even when the process is not idle
What is the expected output?
get_cpu_percent(interval=0) should return values > 0.0 at least some time
What do you see instead?
values at 0
What version of psutil are you using? What Python version?
I'm using psutil 0.7.1, directly from code.google.com (same from pypi), with
python 2.7
On what operating system? Is it 32bit or 64bit version?
It's an Ubuntu 13.04 64bit
Please provide any additional information below.
There are 4 logical CPUs on this system.
From psutil doc:
> When interval is 0.0 or None compares process times to system CPU
> times elapsed since last call, returning immediately. In this case
> is recommended for accuracy that this function be called with at
> least 0.1 seconds between calls.
That means the very first get_cpu_percent(interval=0) call will produce a
meaningless value as it has no previous value to compare against.
It therefore means you'll need at least TWO calls in order to produce a
meaningful result and wait some time between one call and the other.
Thank you for your quick answer Giampaolo. I forgot to tell that several calls,
for the same process, with 5 sec. intervals, always give 0.
Is it relevant to say that everytime I call get_cpu_percent, I create a new
instance of Process ?
From steve.ko...@gmail.com on June 06, 2013 14:26:08
Original issue: http://code.google.com/p/psutil/issues/detail?id=390
The text was updated successfully, but these errors were encountered: