LWN.net Logo

Advertisement

E-Commerce & credit card processing - the Open Source way!

Advertise here

The high-resolution timer API

The high-resolution timer API

Posted Jan 19, 2006 13:14 UTC (Thu) by hein.zelle (guest, #33324)
Parent article: The high-resolution timer API

A question that may not be sensible at all, as this concerns kernel functions: will these functions be usable from userspace somehow, to achieve better precision than e.g. 0.01 second when using functions like usleep() or gettimeofday() ? I am not familiar with the technical details, but my earlier attempts at achieving greater time resolution all failed.

Is there already a common way to achieve higher resolution from a C program?


(Log in to post comments)

High-resolution timers in user space

Posted Jan 19, 2006 14:51 UTC (Thu) by corbet (editor, #1) [Link]

I suppose I could have said something about that... hrtimers are used now for the implementation of POSIX timers and for the nanosleep() call, so, in that sense, yes they are available to user space.

The other thing which I really should have mentioned (I did in an earlier article) was that, in order to provide truly high resolution, you also need a high-resolution clock within the kernel. Current kernels still do not have that, so the hrtimer interface still works with HZ resolution - 4ms on i386 with the default configuration. There are a few high-resolution clock patches around, mainly tied to John Stultz's low-level clock rework; something should get merged before too long, I would think (but not for 2.6.16).

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds