Messages in this thread | | | From | Andy Lutomirski <> | Date | Sat, 24 Dec 2011 20:06:18 -0800 | Subject | Re: [RFC 0/2] ABI for clock_gettime_ns |
| |
On Fri, Dec 23, 2011 at 10:50 PM, Richard Cochran <richardcochran@gmail.com> 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.
--Andy
> > Just curious, > > Richard
-- Andy Lutomirski AMA Capital Management, LLC Office: (310) 553-5322 Mobile: (650) 906-0647
| |