Re: CLOCK_REALTIME_RES and nanosecond resolution

From: Steven Rostedt
Date: Mon Nov 07 2005 - 23:19:38 EST


On Tue, 2005-11-08 at 13:55 +1100, Benjamin Herrenschmidt wrote:
> Hi !
>
> I noticed that we set
>
> #define CLOCK_REALTIME_RES TICK_NSEC /* In nano seconds. */
>
> Unconditionally in kernel/posix-timer.c
>
> Doesn't that mean that we'll advertise to userland (via clock_getres) a
> resolution that is basically HZ ? We do get at lenght to get more
> precise (up to ns) resolution in practice on many architectures but we
> don't expose that to userland at all. Is this normal ?

Yes.

Until ktimers/high-res or another variant gets incorporated into the
kernel, the only resolution you will get for user applications is HZ.
So even though we may have timers that are much faster than HZ (which
there are a lot of them), the kernel only will work with timers on a
jiffy basis.

On a 2.6.13 I get a response of 0.004000250 seconds from clock_getres
with a HZ of 250.

On 2.6.14-rc5-kthrt7 (Thomas Gleixner's ktimers+high-res) I get from
clock_getres: 0.000001000 seconds. And this seems to be accurate.

-- Steve


-
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/