re: clock_gettime(2). I have a few random things to add there that came out of some benchmarking that I did about a year ago for FreeBSD and is of some relevance. Issues regarding the correctness of yet- another-clock_id aside, on FreeBSD CLOCK_REALTIME_FAST is ridiculously fast compared to CLOCK_REALTIME. I don't know what degree of precision you're looking for in these time calls since CLOCK_REALTIME_FAST only gets updated once a HZ, but it's a pretty significant speedup.
The URL to the full post is below, but the specific excerpts from the benchmark can be seen here: % ./bench_time 9079882 | sort -rnk1 Timing micro-benchmark. 9079882 syscall iterations. Avg. us/call Elapsed Name 9.322484 84.647053 gettimeofday(2) 8.955324 81.313291 time(3) 8.648315 78.525684 clock_gettime(2/CLOCK_REALTIME) 8.598495 78.073325 clock_gettime(2/CLOCK_MONOTONIC) 0.674194 6.121600 clock_gettime(2/CLOCK_PROF) 0.648083 5.884515 clock_gettime(2/CLOCK_VIRTUAL) 0.330556 3.001412 clock_gettime(2/CLOCK_REALTIME_FAST) 0.306514 2.783111 clock_gettime(2/CLOCK_SECOND) 0.262788 2.386085 clock_gettime(2/CLOCK_MONOTONIC_FAST) Last value from gettimeofday(2): 1212380080.620649 Last value from time(3): 1212380161 Last value from clock_gettime(2/CLOCK_VIRTUAL): 2.296430000 Last value from clock_gettime(2/CLOCK_SECOND): 1212380338.000000000 Last value from clock_gettime(2/CLOCK_REALTIME_FAST): 1212380243.461081040 Last value from clock_gettime(2/CLOCK_REALTIME): 1212380240.459788612 Last value from clock_gettime(2/CLOCK_PROF): 185.560343000 Last value from clock_gettime(2/CLOCK_MONOTONIC_FAST): 5747219.271879584 Last value from clock_gettime(2/CLOCK_MONOTONIC): 5747216.886509281 http://sean.chittenden.org/news/2008/06/01/ Random drive-by $0.02. -sc -- Sean Chittenden [email protected] -- Sean Chittenden [email protected] _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
