Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
Announcements

TSC Frequency Computation on Haswell Microarchitecture

Beginner
440 Views

Hi all,

According to the Intel Specifications Volume 3 section 14.5.5, the average frequency formula is:

``Favg = (TSC frequency) * (delta(IA32_APERF)/delta(IA32_MPERF))``

There are two methods to calculate the TSC frequency:

1) The first method is based on the value of MSR_PLATFORM_INFO[15:8] (register address is CEH). The output of the command rdmsr 0xCE is 80838f3011800. Then,  MSR_PLATFORM_INFO[15:8] = 18 (24 in decimal). So, the TSC frequency = 24* 100 = 2400 MHz

2) Another method to determine the processor base frequency based on the following formula ( Intel Specifications Volume 3 section 18.18.3):

`` Nominal TSC frequency = (CPUID.15H.ECX[31:0] * CPUID.15H.EBX[31:0] ) / (CPUID.15H.EAX[31:0])``

Then, the output of the command cpuid -r -l 0x15 is:

``  0x00000015 0x00:  eax=0x00000007  ebx=0x00000340  ecx=0x00000340  edx=0x00000000``

eax = 7 (hexa) = 7 (decimal)

ebx = 340 (hexa) = 832 (decimal)

ecx = 340 (hexa) = 832 (decimal)

Indeed, the nominal TSC frequency = (832 * 832) / 7 = 98889.14

----------------------------------------

Each method gives a different value of TSC frequency  (very important gap). Can you help me to know which value to consider?

Best regards,

Black Belt
401 Views

The first method is clearly correct.

The second method is new and I don't think it is supported on Haswell processors.  If you execute CPUID with an initial EAX value of 0, the return value in EAX is the largest supported CPUID "leaf" number.  On my Haswell (Xeon E5 v3) boxes that is 0xf, so the argument of 0x15 is out of range.   On my Broadwell (Xeon E5 v4) boxes, the value is 0x14 -- still too small to support the 0x15 input argument.