[lkml]   [2011]   [Dec]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC 0/2] ABI for clock_gettime_ns
On Fri, Dec 23, 2011 at 10:50 PM, Richard Cochran
<> wrote:
> On Fri, Dec 23, 2011 at 09:59:04PM -0800, Andy Lutomirski wrote:
>> I've written the patch and it's not as big an improvement as I hoped.
>> I'll play with it a bit and send it out soon.
> Andy, can you say what the motivation or use case is?

Simplicity and performance. Many users (e.g. I) use clock_gettime to
measure elapsed time. We just end up converting to flat nanoseconds
over and over. This syscall avoids the conversion.

The added padding bits will allow UTC/TAI offset and/or sub-nanosecond
precision in the future if someone wants to add them.

I seem to be saving just over one nanosecond per call on my laptop,
which isn't that impressive. The real-world improvement may be better
-- calling clock_gettime in a tight loop should give very good branch
prediction success, which will make the cost of the loops that flat ns
avoids seem a little lower than they are.

I'll send patches in the morning.


> Just curious,
> Richard

Andy Lutomirski
AMA Capital Management, LLC
Office: (310) 553-5322
Mobile: (650) 906-0647

 \ /
  Last update: 2011-12-25 05:09    [W:0.053 / U:9.364 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site