-
Notifications
You must be signed in to change notification settings - Fork 77
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
Values don't match Windows task manager? #51
Comments
Task Manager calculates CPU usage for processes by also including the child processes in the final value, if I'm not mistaken. NTop doesn't do that (yet). Task Manager also likely uses a different API and a different schedule for sampling data which should explain further discrepancies in the data. |
I noticed the child-process issue, but if you look at my screenshot you'll see that's not the problem. It's very frustrating that it's different. One of them must be "wrong", right? |
@grepnick NTop calculates its "own" CPU utilization in https://github.com/gsass1/NTop/blob/master/ntop.c#L756 and does not use any Windows APIs for directly grabbing these values. My algorithm is not very sophisticated, but the precision may be improved if you tweak the "sampling rate" as defined in https://github.com/gsass1/NTop/blob/master/ntop.c#L907 My own assumption is that Task Manager uses some kind of Windows-internal API that calculates CPU usage on the kernel level with much better precision. |
Update @gsass1 You can see this phenomenon by comparing the Windows Performance Monitor CPU utilization to Task Manager. As you can see from the Windows Performance Monitor, the average CPU utilization is 6% (roughly the same at Ntop). At the same time, Windows Task manager shows CPU usage as about 70%. While the Task Manager was consistently reporting 70% CPU utilization, CIM performance counters show the total overall CPU usage at 5%.
|
I think it's time we switch from calculating our own usage values to just using Windows' performance counter API. |
I've tried this on a couple PCs at this point, one Win 11 and one 10. They both have similar results. NTop reports significantly lower utilization than Windows Task Manager for any given process (I've tested with a browser on a CPU load test site, Unity apps, etc).
The weird thing is that I only found NTop because I was trying to do this with PowerShell and it was inaccurate. The inaccuracies for
Get-Process
andGet-Counter
seem to be similar to NTop. Again, I've tried this on multiple systems. What is going on?Here's an example: https://imgur.com/gyApdCS
The text was updated successfully, but these errors were encountered: