Messages in this thread | | | Date | Wed, 8 May 2002 08:21:00 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | Re: Measure time |
| |
On Wed, 8 May 2002, Serguei I. Ivantsov wrote:
> Hello! > > Is there any function for high precision time measuring. > time() returns only in second. I need nanoseconds. > > -- > Regards, > Serguei I. Ivantsov > GSC Game World >
gettimeofday() returns seconds/microseconds. If you need nanoseconds, you can read CPU clock cycles in Intel machines with (assembly) rdtsc instructions and convert, based upon the CPU clock.
If you really need nanosecond resolution in code that may be interrupted or preempted at any time, you are in a world of hurt. I suggest you review the requirement. You may need a TMS320C30 or similar DSP standing alone.
Cheers, Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Windows-2000/Professional isn't.
- 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/
| |