Is the Windows Task Manager performance graph misleading? (for CPU bound operations) [closed]

StackOverflow https://stackoverflow.com/questions/21655220

  •  08-10-2022
  •  | 
  •  

Вопрос

I'm looking at a Windows Task Manager Performance Graph (below). It appears to be maxing out at 50% (where I have two cores). I'm trying to work out if the underlying CPU operation is CPU-bound.

My question is: Can I trust the graphs that the underlying operations are spread across the two CPUs? Or should I just look at the percentage which tells me that the current processes running have maxed out at 50% of my two cores?

enter image description here

Это было полезно?

Решение

When you see a dual-core CPU pegged out at 50% it's a strong indication that there is exactly one thread (of a given process) that is using the maximum amount of CPU resources the operating system can give to it. Why 50% and not 100% ? Because when this thread is running there is always exactly one other CPU core that has near nothing to do. The same test on a quad-core would show the CPU meter pegged at 25%. A single-core machine would show the CPU pegged at close to 100%.

In your case, if you ran two or more instances of this same program, the CPU meter would peg out at 100%.

The OS may run this thread on a different core on each pre-emptive task switch. The fact that each individual graphs are plotting erratically is indicative of this. If you right click on the process in the Processes tab (Detail tab on Win8), you can actually change the process affinity to force the process to run on a specific CPU core. When you do this, one graph will peg at 100% while the other will be idle (near 0%). That's still an overall processor usage of 50%.

Make sense?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top