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: fche at redhat dot com (Frank Ch. Eigler)
- To: Li Guanglei <guanglei at cn dot ibm dot com>
- Cc: "systemtap at sourceware dot org" <systemtap at sourceware dot org>
- Date: 05 Aug 2006 14:12:26 -0400
- Subject: Re: using get_cycles() to get the real elapsed time
- References: <44D4BAB8.4030209@cn.ibm.com>
Li Guanglei <guanglei@cn.ibm.com> writes:
> [...]
> So we need deal with different Arches to get the elapsed time by
> using get_cycles()
Yes, eventually recreating the complexity of gettimeofday().
> BTW, get_cycles() will return 32-bit value for some architectures
> e.g ppc32, although the major architectures such as ppc64, x86,
> x86_64 will all return a 64-bit value. [...]
It's even worse than that: I gather some machines return a putatively
64-bit value, but the number within overflows after a few bits past 40.
So any user of get_cycles() must correct at least for
- change in frequency
- counter overflow
- cross-CPU drift
- FChE