Micro-benchmark for various time syscalls...

Sean Chittenden sean at chittenden.org
Mon Jun 2 19:11:29 UTC 2008


>> rozetta~/devel/c%>sysctl hw.model
>> hw.model: Intel(R) Xeon(R) CPU           E5345  @ 2.33GHz
>>
>> rozetta~/devel/c%>./bench_time 9079882 | sort -rnk1
>> Timing micro-benchmark.  9079882 syscall iterations.
>> Avg. us/call    Elapsed         Name
>> 1.405469        12.761494       clock_gettime(2/CLOCK_REALTIME)
>> 1.313101        11.922799       time(3)
>> 1.305518        11.853953       clock_gettime(2/CLOCK_MONOTONIC)
>> 1.303947        11.839681       gettimeofday(2)
>> 0.442908        4.021557        clock_gettime(2/CLOCK_PROF)
>> 0.436484        3.963223        clock_gettime(2/CLOCK_VIRTUAL)
>> 0.217718        1.976851        clock_gettime(2/CLOCK_MONOTONIC_FAST)
>> 0.215264        1.954571        clock_gettime(2/CLOCK_REALTIME_FAST)
>> 0.211779        1.922932        clock_gettime(2/CLOCK_SECOND)
>
> These seem about right for a normal untuned ~2GHz system:

This begs the question, tuning for time calls.  Do you have a best  
practice that you use for reducing the cost of time calls?  -sc

--
Sean Chittenden
sean at chittenden.org
http://sean.chittenden.org/



More information about the freebsd-performance mailing list