This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: using get_cycles() to get the real elapsed time
- From: "Gui,Jian" <guij at cn dot ibm dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: "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 13:48:51 +0800
- Subject: Re: using get_cycles() to get the real elapsed time
- References: <20060806205111.AAF9218007E@magilla.sf.frob.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 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.