This is the mail archive of the
mailing list for the systemtap project.
Re: using get_cycles() to get the real elapsed time
- From: "Jose R. Santos" <jrs at us dot ibm dot com>
- To: "Gui,Jian" <guij at cn dot ibm dot com>
- Cc: Roland McGrath <roland at redhat dot com>, "Frank Ch. Eigler" <fche at redhat dot com>, Li Guanglei <guanglei at cn dot ibm dot com>, "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: Mon, 07 Aug 2006 22:52:09 -0500
- Subject: Re: using get_cycles() to get the real elapsed time
- References: <20060806205111.AAF9218007E@magilla.sf.frob.com> <44D6D443.email@example.com>
- Reply-to: jrs at us dot ibm dot com
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 184.108.40.206 code, I found it still lacks the code to
handle the CPU frequency variation in ppc64 arch.
In 220.127.116.11/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 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.