Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report CPU percentage over 100 on multicore processors #194

Closed
giampaolo opened this issue May 23, 2014 · 9 comments
Closed

report CPU percentage over 100 on multicore processors #194

giampaolo opened this issue May 23, 2014 · 9 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on August 09, 2011 01:07:02

What steps will reproduce the problem?  
1. call get_cpu_percent on a multicore linux system 

What is the expected output?  


What do you see instead?  
Expect to see values in accordance to `top` output, or scaled appropriately - 
it is expected and normal behavior for Linux systems to report a total cpu% 
across all cores - values above 100% are meaningful.

What I see is, CPU % reports that track correctly with `top` output until 
the value reported by `top` exceeds 100%, at which point psutil returns 
only 100%. 

What version of psutil are you using? What Python version?  
psutil 3.0
Python 2.6 

On what operating system? Is it 32bit or 64bit version?  
Fedora 13 32bit on an Intel Core 2 Quad.
Ubuntu 10.10 32bit on an intel i7.
OSX Snowleopard on an intel Core 2 Duo.

The linux systems are running generic SMP kernels as identified by `uname -a` 

Please provide any additional information below.  
Some evidence in support: 
http://stackoverflow.com/questions/1032357/comprehending-top-cpu-usage Some 
conversations in mailing list indicate this was a deliberate decision in 
development, but this is a truncation of meaningful data.  

In my specific case, I am benchmarking multithreaded software applications that 
offload a dedicated processing thread to at least a second core, and getting 
only '100%' as a cpu measurement is not useful, as it is often guaranteed 
to be above 100%.

Original issue: http://code.google.com/p/psutil/issues/detail?id=194

@giampaolo
Copy link
Owner Author

From g.rodola on October 22, 2011 04:41:20

Sorry for the delay in responding.
This is now fixed in r1182 .

Status: FixedInSVN
Labels: Milestone-0.4.0 OpSys-UNIX

@giampaolo
Copy link
Owner Author

From g.rodola on October 28, 2011 20:44:14

Status: Fixed

@giampaolo
Copy link
Owner Author

From [email protected] on October 28, 2011 21:46:22

Hope its not inappropriate to say this in the bug, but thank you! Your 
attention to this issue has been most beneficial.

@giampaolo
Copy link
Owner Author

From g.rodola on October 28, 2011 21:49:08

It's definitivey not inappropriate . You're welcome. ;)

@giampaolo
Copy link
Owner Author

From [email protected] on November 03, 2011 21:47:57

I am experiencing the same problem on Windows. In get_cpu_percent() of 
__init__.py:

        if os.name != 'posix':
            if single_cpu_percent > 100.0:
                return 100.0

The above code specifically clips the value for Windows. Obviously, there seems 
to be a conscious decision here but is there a way around this?

@giampaolo
Copy link
Owner Author

From g.rodola on November 04, 2011 02:04:49

Yes, it was on purpose as the problem was treated as UNIX-specific.
I don't recall ever getting values over 100% on Windows/taskmgr.exe, therefore 
I'd say the piece of code above is there just for avoiding troubles with float 
precision issues.

@giampaolo
Copy link
Owner Author

From [email protected] on November 10, 2011 20:38:18

Thanks for your clarification.

I haven't seen values exceed 100% on Windows either. However, what I have seen 
is sometimes, a process may exceed 100 * NUM_CPUS, which is quite unusual. Is 
this a known issue on Linux? I am using Ubuntu 8.10, where NUM_CPUS == 2.

@giampaolo
Copy link
Owner Author

From g.rodola on November 10, 2011 23:09:27

Well, yes, on Linux CPU can exceed 100%, this was the whole point of this 
issue: http://stackoverflow.com/questions/1032357/comprehending-top-cpu-usage

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:02:30

Updated csets after the SVN -> Mercurial migration: r1182 == revision 
3fbcc4bd088e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant