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

Windows CPU times can add up to > 100% #653

Closed
conorbranagan opened this issue Sep 4, 2013 · 7 comments · Fixed by #1042
Closed

Windows CPU times can add up to > 100% #653

conorbranagan opened this issue Sep 4, 2013 · 7 comments · Fixed by #1042
Assignees
Milestone

Comments

@conorbranagan
Copy link
Member

We're collecting PercentUserTime and PercentIdleTime from Win32_PerfFormattedData_PerfOS_Processor which shouldn't ever add up to more than 100%, but it seems like it does.

Maybe we need to use a different metric other than PercentIdleTime?

@MisterRayCo
Copy link
Contributor

screen shot 2013-09-04 at 1 40 43 pm

@remh
Copy link
Contributor

remh commented Jul 3, 2014

We should try if this can be reproduced with psutil, and maybe use psutil to solve that issue.

@bunelr bunelr self-assigned this Jul 7, 2014
@bunelr
Copy link
Contributor

bunelr commented Jul 17, 2014

At first I thought that it could be related to this issue that was on psutil: (broken windows api where cpu times is sometimes decreasing) but I think that maybe we're not getting PercentUserTime correctly:

From msdn doc,
PercentUserTime and PercentPrivilegedTime are Percentage of non-idle processor time and we report then directly so we may have been over-reporting them ( not dividing them by PercentProcessorTime )

I'm a bit worried that on the docs linked PercentIdleTime is described as the 'sample interval that the disk was idle' but it's probably just a typo, given that the basis of the data here report it as the processor Idle time.

I'll try correcting the values and see if we get better results

@bunelr
Copy link
Contributor

bunelr commented Jul 17, 2014

After checking, it seems that we're getting the points correctly because PercentUserTime and PercentPrivilegedTime always sum up to roughly PercentProcessorTime so they must be a percentage of the total time and there is no need for correction.

Reporting system.cpu.idle as 100 - PercentProcessorTime should give better results (I build one check reporting this way and haven't seen any value getting over 100) but it still feels like it isn't a proper solution. I'll try deducing the values from PerfRawData instead to see if we can get saner results

@remh
Copy link
Contributor

remh commented Jul 17, 2014

Should we just switch to psutil to get these metrics on Windows ? How does psutil get them ?

@bunelr
Copy link
Contributor

bunelr commented Jul 18, 2014

Psutil calls another system function GetSystemTimes with which it gets kerneltime, usertime and idletime, waits, and then call this function again, which allows him to deduce the percentages of time spent in user mode, system mode and idle mode.
An issue is that we also get system.cpu.interrupt that is not available with psutil.

Update on using 100-PercentProcessorTime instead of PercentIdleTime: it also gets >100 spikes

I'll check collecting the value we can with psutils and keeping the wmi solution for system.cpu.interrupt

@conorbranagan
Copy link
Member Author

👍

@remh remh modified the milestones: 5.0, Future Jul 22, 2014
@remh remh added 3 - Done and removed 2 - Working labels Jul 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants