Pinned topic Support for the IBM Advanced Toolchain
mylap 1000003E6W9 Posts
sphfastcpufreq - what freqquency is returned ?2014-02-11T23:06:48ZThis is the accepted answer. This is the accepted answer.
I'm running the at7.0.3 on Suse Linux 11 sp3 - on a POWER7 LPar
In the C code I'm working with (sysjitter.c ) the following call is made to sphfastcpufreq
static unsigned measure_cpu_mhz(void)
return (unsigned) (sphfastcpufreq() / 1000000);
But the problem is this returns a value of 512 ! (ie. sphgetfastcpufreq is returning 512000000 (512Mhz)
But my POWER7 cpu is a 3.3Ghz model - shouldn't this return 3300000000 and not 512000000 ?
What is this call doing exactly - is it the headline CPU frequency that is meant to be returned - or something else ?
Later in the code
sphgettimer(); is called to get the number of cycles before and after a thread is executed.
Are these cycles relative to the 512Mhz reported clock or the true CPU frequency of 3.3GHz ?
I did look for the man page for this call in /opt/.at7.0/share/man - but if it's in there it not obvious to me where it is
having set the man path "man sphgetfastcpufreq" also returns nothing (although there is a brief decription in sphtimer.h)
sjmunroe 100000GT068 Posts
Re: sphfastcpufreq - what freqquency is returned ?2014-02-12T03:28:32ZThis is the accepted answer. This is the accepted answer.
- mylap 1000003E6W
On Intel processors this will return something clost to the nominal CPU clock frequency.
But on POWER (Server PowerISA) there is a separate timebase register and clock that is constant and independant of the CPU clock. The CPU clock is constantly adjusted for power management, but the timebase clock is contant and the timebase value is synchronized across all cores in the system.
So 512MHz is the just timebase frequence for POWER7. This is used for time of day and makes fast accurate interval timer for performance measurement.
This function is returning a value read from /proc/cpuinfo and cached for fast access.
processor : 71
cpu : POWER7 (architected), altivec supported
clock : 3000.000000MHz
revision : 2.1 (pvr 003f 0201)
timebase : 512000000
platform : pSeries
model : IBM,8233-E8B
machine : CHRP IBM,8233-E8B