using get_cycles() to get the real elapsed time
Li Guanglei
guanglei@cn.ibm.com
Tue Aug 8 05:22:00 GMT 2006
The following is the internal discussion that didn't copy the
SystemTap mailinglist. FYI.
Paul Mackerras wrote:
>
>
>
> Correct - IBM's POWER4 and POWER5 systems don't provide any hardware or
> firmware mechanism to change the CPU frequency. There are 64-bit PowerPC
> systems which do, for instance Apple's G5 machines.
>
> --
> Paul Mackerras, Ph.D.
> PowerPC Linux Kernel Architect
> STSM
> IBM Linux Technology Center OzLabs
> Canberra, Australia
>
>
>
> guanglei@cn.ltcfw
> d.linux.ibm.com
> To
> 08/08/06 12:09 PM Paul Mackerras/Australia/IBM@IBMAU
> cc
> Vara Prasad <prasadav@us.ibm.com>,
> ananth@in.ltcfwd.linux.ibm.com,
> Anton
> Blanchard/Australia/IBM@IBMAU,
> guij@cn.ltcfwd.linux.ibm.com, Jim
> Keniston <jkenisto@us.ibm.com>,
> paulus@ozlabs.au.ibm.com
> Subject
> Re: using get_cycles() to get the
> real elapsed time
>
>
>
>
>
>
> Paul Mackerras wrote:
>>
>>
>> Vara,
>>
>> No, this is not a bug, in fact it is one place where PowerPC machines do
>> better than x86. :) PowerPC has a constant-frequency, high-resolution
>> counter called the timebase register, which is cheap to read and which
>> counts synchronously across all processors in an SMP system, and that's
>> what get_cycles and sched_clock read. The timebase frequency doesn't
>> change when the CPU frequency changes, which is why the tb_to_ns_*
>> variables don't get changed when the CPU frequency changes.
>>
>> --
>> Paul Mackerras, Ph.D.
>> PowerPC Linux Kernel Architect
>> STSM
>> IBM Linux Technology Center OzLabs
>> Canberra, Australia
>
> I ever tried to enable CONFIG_CPU_FREQ in the Kernel and used the
> CONSERVATIVE governor on Power5 platform. But the cpu frequency won't
> change when CPU is idle and I didn't find a entry existed in
> /sys/devices/system/cpu/cpu0/cpufreq
>
> I searched inside IBM intranet and found the Time Base on Power5 will
> be driven at 1/8 of the CPU frequency. I think the Power5 CPU doesn't
> has the CPU frequency scaling feature. So the CPU frequency will be
> constant, and then the Time Base will also be increased at a
> constant-frequency. And I think it's the same with Power4. Am I right?
>
> Another question: Does anybody know how to call sched_clock() in a
> kernel module? insmod complains of unknown symbol of sched_clock
>
> Thanks.
>
> - Guanglei
>
>
More information about the Systemtap
mailing list