lkml.org 
[lkml]   [2009]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] Introduce CLOCK_REALTIME_COARSE

* john stultz <johnstul@us.ibm.com> wrote:

> Hey all,
>
> After talking with some application writers who want very
> fast, but not fine-grained timestamps, I decided to try to
> implement a new clock_ids to clock_gettime():
> CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE which returns the
> time at the last tick. This is very fast as we don't have to
> access any hardware (which can be very painful if you're using
> something like the acpi_pm clocksource), and we can even use the
> vdso clock_gettime() method to avoid the syscall. The only trade
> off is you only get low-res tick grained time resolution.
>
> This isn't a new idea, I know Ingo pushed a patch (see commit
> 5899a0f044f3c80e9f7262ec5bc7164773a4c28e) a little while ago that
> made the vsyscall gettimeofday() return coarse grained time when
> the vsyscall64 sysctrl was set to 2. However this affects all
> applications on a system.

Note, that patch is an -rt commit, right? I.e. not yet upstream.

> With this method, applications can choose the proper
> speed/granularity trade-off for themselves.
>
> This is a first pass on this implementation, and while I did test
> it, the box I tested it with did not have a glibc new enough to
> utilize the vdso clock_gettime(), so there may still be issues
> there. I'll find a newer box for testing shortly.
>
> Any thoughts or feedback will be appreciated!

Looks good. I think we should offer both methods: your patch as an
unconditional 'coarse time' approximator always available
everywhere, plus the vsyscall redirector as well from -rt, to allow
admins/users to tweak in a global way on apps that cannot be
changed.

Ingo


\
 
 \ /
  Last update: 2009-07-18 14:13    [W:0.087 / U:2.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site