RE: timing an application

David Mosberger (davidm@napali.hpl.hp.com)
Tue, 14 Jan 2003 13:34:15 -0800


>>>>> On Tue, 14 Jan 2003 12:37:05 -0800, "Howell, David P" <david.p.howell@intel.com> said:

Dave> If this is on a IA32(Pentium II or later)/IA64 have you
Dave> considered using the processor TSC register to get interval
Dave> timestamps? It's a lot lighter weight and should give better
Dave> resolution. When we have done this we compared the tick values
Dave> directly.

Dave> To convert TSC ticks to time the /proc/cpuinfo value for 'cpu
Dave> MHz', see the glibc get_clockfreq.c and hp_timing.h
Dave> implementation for details.

Note that it's tricky to uses TSC/ITC on multiprocessors, especially
on large machines, on which the clocks for different CPUs may drift, etc.
It's much better to use the clock_gettime() routine:

http://www.opengroup.org/onlinepubs/007908799/xsh/clock_getres.html

Where properly implemented, this will be both as fast and accurate.

--david
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/