Re: timer question

From: Chris Friesen
Date: Thu Apr 01 2004 - 01:12:59 EST


Richard B. Johnson wrote:
On Wed, 31 Mar 2004, Chuck Lever wrote:


hi all-

i'm looking for a way to do microsecond resolution timing in the RPC
client. i need a timer or timestamp function that is fairly cheap, that i
can call on any hardware platform, and that i can invoke from inside a
bottom half.

any suggestions?

As Dick Johnson said, x86 has rdtsc. PowerPC has the mftbr, which is equivalent. MIPS has something similar.

Many architectures have something, but currently it has to be coded for each.

One thing that might be nice would be a common API to get a high-res timestamp, something like a 64-bit nano_uptime, which would be good for uptimes of up to 524 years at nanosecond precision. Or else you could just use timespec, although its not as nice on actual 64-bit machines.

Chris

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