This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: time stamp counter in "make check"
On Wed, Jul 25, 2012 at 11:24:20AM -0700, Roland McGrath wrote:
> Using rdtsc or the like for user-mode CPU timings is always wrong.
> Even if the CPU issues are handled perfectly, it's only ever right
> when the luck of the draw doesn't introduce any scheduling delays
> in the middle of what you're timing.
rdtsc has error which is not important as you can get accurate result
by discarding top and bottom 1%.
What is importatnt is bias for which cpuid/rdtscp causes more problems
that it solves. You must take account for cache coherence,speculative
loads, lookahead. As these are function dependent you can get result
that function A in two times faster that B while in reality B is twice
as fast as A.