Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I get the true usage of a multicore hyperthreading enabled cpu?

For example lets consider a 2 core CPU, expressing 4 virtual cores.

A single threaded workload would now show up as 100% in top, as one core of the virtual cores is completely used. The CPU and top work as expected, like there would be 4 real cores.

With two threads however, the things get arkward: If all works well, they are balanced to the two real cores, so we got 200% usage: Two times 100% and two idle virtual cores, and are using all of the available CPU power. Seems ok to me.

However, if the two threads would run on a single real core, they would show up as using two times 100%, that makes 200% virtual core usage. But on the real side, that would be one core sharing its power on the two threads, which are then using only one half of the total CPU power.

So the usage numbers shown by top can not be used to measure the total CPU workload.

I also wonder how hyperthreading balances two virtual on a real core. If two threads take a different amount of cycles, would the virtual cores 'adapt' so that both show a 100% load even if the real load differ?

share|improve this question
You do understand the operator system is not aware of the difference between a hyperthreading virtual core and the physical core right? –  Ramhound Jun 28 '13 at 10:15
It seems so, but it doesn't have to? The real vs. virtual core mapping is a simple one to two map. The problem is how to measure load on a virtual core that actually changes its available performance by getting scheduled with another one on the real core. But all data is avalable I think, the question is just where are the tools that get a proper result out of them? –  dronus Jul 19 '13 at 0:14
I just like to have a load measure where 100% would mean that every cycle of every real core is used. –  dronus Jul 19 '13 at 0:17
It's not clear why you come to that conclusion –  Ramhound Jul 19 '13 at 22:47
This is obviously a reason why the OS should be aware of virtual cores. So it has to find out and compute the physical core usage based on it. Otherwise the whole concept of measureing "usage" and "load" has no use to the user. If I run top, I usually have some question like "Is the system running at it's limit?" or "Would it be useful to divide the work into more processes?" etc. This questions can't be reliable answered by the current topoutput. –  dronus Jul 25 '13 at 12:45

1 Answer 1

If you have two similar programs running on the same hyperthreaded physical core you will see two virtual processors at 100% (run top and press "1") and two process lines, each of which displaying 100% under the CPU field.

However the throughput is not twice as what you had with a single program running.

The first instance of your program, running alone, will do X operations per second, but as you launch a second one on the same physical core both of them will do y operations per second, where y is way smaller than x. The total is 2y, which is between 10 and 30% higher then x.

So, unfortunately the load that you see on the process lines in top is not proportional to the throughput (ie, effective work done) and if you use HT (or recent AMD Opterons...) you must have that in mind.

Responding to your last question:

Your CPU is capable of doing further work without slowing down the current work if you have at least one physical core without any load; a better formulation is having all the physical cores working and launching a set of extra processes with a smaller priorities that will run "in part time" on the second threads of each core, whenever the running processes are idle.

Reference: http://blog.angulosolido.pt/2014/01/core-confusion.html

share|improve this answer
The problems you mention is exactly what I encountered, however the question was, how to take a correct measurement then. –  dronus Oct 14 '14 at 10:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.