I’m often asked the question when looking at vSphere statistics – “What is the difference between PCPU Used and PCPU Utilized and why don’t they match?” Let’s take a look as it can be somewhat complex.
First lets start with some definitions:
- Time Stamp Counter (or TSC) – is a 64 bit register available on all modern processors that counts clock cycles at a consistent rate and is not affected by changes in clock frequency.
- Unhalted Cycles – another count of ‘all’ clock cycles, but this one is dependent on the clock frequency and therefore the rate can change if the clock frequency changes (due to things like power management or Hyper-Threading).
- Wall Clock Time – refers to elapsed real world time.
Okay now lets define our two counters using the above definitions:
- PCPU utilized (which is TSC based) = (non-idle state TSC cycles)/wall clock time
- PCPU used (which is unhalted cycle based) = (unhalted cycles)/wall clock time
So assuming a non Hyper-Threaded system, and no power management is being used, PCPU utilized = PCPU used.
Lets look at how Power Management affects these counters:
If power management is enabled and the cpu runs at a lower frequency, unhalted cycles will be smaller than TSC cycles, hence “PCPU used < PCPU utilized”. On the other hand, if turbo mode is activated and the cpu is running with a higher frequency, “PCPU used > PCPU utilized”.
Lets also look at how Hyper-Threading affects these counters:
For Hyper-Threaded systems, each core has two PCPUs and PCPU utilized is calculated using the same way as non-Hyper-Threading systems.
PCPU used is accounted differently:
- If only one PCPU is busy within a core, for this PCPU, PCPU used = (unhalted cycles)/wall clock time * 50%, which means ESX assumes one Hyper-Thread only uses half of the core capacity .
- If both PCPUs within the core are busy, for each PCPU, PCPU used = (unhalted cycles)/wall clock time * 62.5%, which means ESX assumes two Hyper-Thread threads will achieve 125% of core capacity.
So why two different counters and when should I use them?
PCPU utilized indicates how much time a PCPU was busy with time being even, where as PCPU used shows the total amount of work that’s been done while being influenced by technologies like Hyper-Threading and power management. I leverage PCPU utilized for my planning and analysis activities and PCPU used for troubleshooting activities. We expose a lot of counters so always be sure you know what they mean before using them to ensure accuracy and great performance data.
Special thanks to my perf-eng teammates for their help in clarifying these counters.
Other References: http://communities.vmware.com/docs/DOC-11812