This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: using get_cycles() to get the real elapsed time


Gui,Jian wrote:
Roland McGrath writes:
> sched_clock is used by the scheduler and POSIX CPU clocks/timers, which
> have the same requirements of being accurate and cheap.  [...]

Thanks. sched_clock is a good alternate for do_gettimeofday in LKET.
But when I read 2.6.17.7 code, I found it still lacks the code to
handle the CPU frequency variation in ppc64 arch.

In 2.6.17.7/ppc64, it uses
   mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift
to return current time in nanosec units.

But in ppc64 code, tb_to_ns_scale and tb_to_ns_shift are set only once
in time_init() and will be constants after that, while in i386 code
similar scaling factors will be updated each time the CPU frequency
is changed.

Is this a ppc64 bug? or Power cpu doesn't have the cpu frequency scaling feature? Thanks.

Power5 and below does not support frequency scaling. I think the newer versions of PowerPC 970 do support frequency scaling but I'm not sure if that feature is supported on Linux at the moment. Its been a while since I've touched a 970 chip, but I'll try to find out.


-JRS


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]