Jump to content

CPU Utilization is Wrong

Orcblood
On 5/3/2018 at 4:25 AM, Sniperfox47 said:

I honestly wish people would drop all the talk about logical cores since it just serves to confuse people. Yes SMT is great, but representing it as additional cores is super inaccurate.

The problem is that the OS, at least on Intel and AMD processors, can't tell what's being utilized on a physical CPU core. It doesn't have access to that information. All it knows is there's "slots" (for lack of a better term) for scheduling. Whether or not the CPU core can actually do work for both scheduling slots is something the OS can't really predict. So as far as the OS is concerned, a scheduling slot could be another processor or core. In one case, it was (Windows reports Bulldozer as [N modules] cores, [2N modules] logical processors)

 

Though I suppose the nomenclature can change to something else. Linux says how many threads the CPU can run rather than "logical processors"

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, M.Yurizaki said:

The problem is that the OS, at least on Intel and AMD processors, can't tell what's being utilized on a physical CPU core. It doesn't have access to that information. All it knows is there's "slots" (for lack of a better term) for scheduling. Whether or not the CPU core can actually do work for both scheduling slots is something the OS can't really predict. So as far as the OS is concerned, a scheduling slot could be another processor or core. In one case, it was (Windows reports Bulldozer as [N modules] cores, [2N modules] logical processors)

 

Though I suppose the nomenclature can change to something else. Linux says how many threads the CPU can run rather than "logical processors"

Yup.

 

Linux calls them threads.

 

Intel themselves call them threads.

 

AMD themselves only called them cores with CMT where they basically were actually cores (just neutered ones), and now call them threads on Ryzen.

 

Correct me if I'm wrong but I dont think IBM even calls them anything. They just go "it has 12 cores with 8-way SMT" afaict.

 

The Windows Scheduler isn't just a dumb scheduler either. It has information about processor series (which is how they added the tweak for Ryzen to reduce scheduler issues on Windows 10). At the scheduler level they know what threads belong to what cores, and could just go "okay, we'll just visually group these two and call them a core".

Link to comment
Share on other sites

Link to post
Share on other sites

54 minutes ago, Sniperfox47 said:

At the scheduler level they know what threads belong to what cores, and could just go "okay, we'll just visually group these two and call them a core".

That would be nice, but I don't think that would be helpful. People already have misconceptions about SMT in thinking that if they set the processor affinity on a process to the "real" cores or whatever, that the program runs faster. But they're assuming that every thread on the process uses a significant amount of execution resources. And even in such cases where it might be useful, like Ryzen to make sure you're not pushing processes across CCXs, a user still shouldn't have to do that. That's should be the OS's job.

 

Also on a side note I remembered System Monitor on Linux (at least Red Had based distros) call the threads "CPU#"

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, M.Yurizaki said:

Also on a side note I remembered System Monitor on Linux (at least Red Had based distros) call the threads "CPU#"

Screenshot-System-Monitor.png

 

Yeeeeeeeah... that's a Gnome thing. >.> Just ignore them, they're a little special.

Link to comment
Share on other sites

Link to post
Share on other sites

On 5/9/2018 at 12:15 AM, SpaceGhostC2C said:

CPU-Z doesn't display CPU utilization.

That's what I thought, but the way he phrased it made it seem like it did (to me at least).

Link to comment
Share on other sites

Link to post
Share on other sites

Since I donno of any monitring software for CPUs thats very accurate I jsut use task manager to see where I am generally. As in I estmate there is a decent margin of error. Looking mostly to see if I am very close or at 100%.

Link to comment
Share on other sites

Link to post
Share on other sites

I'm quite a bit late to this thread, but I'm surprised that nobody brought up Dan Luu.

https://danluu.com/perf-tracing/

has some good tips on how to get actually accurate CPU reporting times, while going through the process on debugging some really poor performing RPC's.

Quote

If you want to use an tracing tool like the one we looked at today your options are:

  1. Get a job at Google
  2. Build it yourself
  3. Cobble together what you need out of existing tools

(and also read up on https://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem (linked in that blogpost) as well.)

 

 

On topic, this has been known about in the HPC sphere for a long time. https://danluu.com/intel-cat/ (about half way through is the juicy bits)

 

You can "double up" on (some) workloads that are not competitive with each other (For example, if one task needs 100% of the DRAM bandwidth and 0% of the network bandwidth, and the other task needs the opposite, the two tasks would be able to co-locate on the same machine and achieve 200% effective utilization.)

 

Companies can and do this sort of thing, and reap the huge benefits that that includes.

 

Ensure a job for life: https://github.com/Droogans/unmaintainable-code

Actual comment I found in legacy code: // WARNING! SQL injection here!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×