1

I am trying to calculate a process utilization on my machine with Intel hyper-threading.

I have one problem when trying to do the calculation:

I am counting the loops my process is doing when running alone on the physical core and counting it when another process (identical one) is running on the other logical core (same physical core).

I see there is a diff in the amount of loops my process is doing. I guess it's related to the fact I am running in hyper-threading machine.

Is there a way to know what is the exact running time my process did so I will be able to add it to my calculation when I am trying to calculate the process utilization?

Joseph Quinsey
  • 9,553
  • 10
  • 54
  • 77
user1120875
  • 21
  • 1
  • 3
  • top should give you correct utilization even on hyperthreaded machines – Jesus Ramos Jan 04 '12 at 12:26
  • my process is running alone (almost) on the core... i want to see how load it is by calculating the amount of loops. top will show me 98% all the time. this is not good for me – user1120875 Jan 04 '12 at 17:00
  • Well you're using 98% of the cpu in that case, there's really nothing else to say. Hyperthreading can be disabled via the BIOS or other utilities so turn it off and see if the number changes, this may give you a better view of cpu usage on other systems possibly. – Jesus Ramos Jan 04 '12 at 17:03

1 Answers1

2

You can only tell how much of the logical CPU's time a process takes. You can't tell how much it uses the physical CPU, and it isn't really defined.
HyperThreading (or, at least, the more modern SMT) doesn't work by dividing the physical CPU time between two threads. It works by assigning work to the execution units within the CPU (and there are several such units).
So it's possible for both threads to run at once - there are several integer execution units, and some others (memory, floating point).

Bottom line - if a thread takes 100% of the logical CPU, then it takes 100% CPU. That's all you can tell.

ugoren
  • 16,023
  • 3
  • 35
  • 65