Home Benchmarks Software Miscellaneous

gettimeofday

The gettimeofday system call is used at a high frequency by many time-sensitive software such as transactional systems. Amortizing the cost of gettimeofday may be more beneficial on some architectures and target operating systems depending on the underlying implementation of the function. Typically, the function is backed by some form of a system call. You may download the benchmark at http://repnop.org/carte/snippets/time.c. The benchmark will compute the absolute cost (in CPU ticks) of gettimeofday and clock_gettime as well as the relative cost to an expensive serializing instruction (cpuid in this case, including associated costs of register spillage). The usage of cpuid as a basis is arguable but it is not muddled by additional unpredictable cache coherency overheads. Please avoid the compulsion to compare across different machines as the underlying chipset (and timer source) will drastically impact associated overheads. Please note that on 17/10/2011 this microbenchmark was updated to use a cpuid-protected rdtsc as the basis.

Recent Results

Previous Results

gettimeofday

Processor BrandKernelRelative CostAbsolute Cost
AMD Athlon 64 X2 3800+FreeBSD 6.2-RELEASE54.55158113153 / 241
Intel Atom 330FreeBSD 8.1-RC218.2890746318 / 345
Intel Atom N270 1.6GHzLinux 2.6.35-24-generic15.8070055753 / 364
Intel Xeon E5504 2GHzFreeBSD 8.1-RELEASE14.1264625585 / 395
Intel Xeon X3450 2.67GHzFreeBSD 8.1-RELEASE12.0456424750 / 394
Intel Pentium M Dothan 630.14MHzNetBSD 5.1 (ichlpcib0)9.6509433324 / 344
Intel Pentium 4 2.4GHzFreeBSD 7.2-RELEASE4.743968 / 836
Dual Core AMD Opteron 285SunOS 5.10 Generic_120012-143.513130836 / 238
AMD Athlon II X2 250 3GHzNetBSD 5.99.44 (clockinterrupt)2.000000625 / 312
Intel Xeon E5530 2.4GHzLinux sbahra 2.6.18-194.3.1.el50.735526268 / 364
Intel Core i3 CPU 3.07GHzDarwin 10.5.00.648218259 / 399

CLOCK_REALTIME

Processor BrandKernelRelative CostAbsolute Cost
AMD Athlon 64 X2 3800+FreeBSD 6.2-RELEASE54.59616426329 / 482
Intel Atom 330FreeBSD 8.1-RC218.27532612628 / 691
Intel Atom N270 1.6GHzLinux 2.6.35-24-generic15.69368111425 / 728
Intel Xeon E5504 2GHzFreeBSD 8.1-RELEASE14.12298511167 / 790
Intel Xeon X3450 2.67GHzFreeBSD 8.1-RELEASE12.1115699553 / 788
Intel Pentium M Dothan 630.14MHzNetBSD 5.1 (ichlpcib0)9.2663286384 / 689
Intel Pentium 4 2.4GHzFreeBSD 7.2-RELEASE4.747073 / 1673
Dual Core AMD Opteron 285SunOS 5.10 Generic_120012-143.7306251745 / 467
AMD Athlon II X2 250 3GHzNetBSD 5.99.44 (clockinterrupt)2.0523791283 / 625
Intel Xeon E5530 2.4GHzLinux sbahra 2.6.18-194.3.1.el51.4727831075 / 730

CLOCK_REALTIME_FAST

Processor BrandKernelRelative CostAbsolute Cost
Intel Atom 330FreeBSD 8.1-RC28.0057895532 / 691
Intel Pentium 4 2.4GHzFreeBSD 7.2-RELEASE4.2274027073 / 1673
Intel Xeon X3450 2.67GHzFreeBSD 8.1-RELEASE3.0827262431 / 788
Intel Xeon E5504 2GHzFreeBSD 8.1-RELEASE3.0395192403 / 790

Acknowledgements

Thanks (in no particular order) to Devon O'Dell for the X3450 benchmark data, Tobias Nygren for Athlon II X2 250 benchmark data, Taylor R. Campbell for Pentium M benchmark data, Eugene Zykov for Penitum M (Dothan) benchmark data, John Peacock for Intel Atom N270 benchmark data, Aleksej Saushev for Intel Core 2 Duo T6670 benchmark data and Harrison Grundy for FreeBSD Atom, Xeon E5504 and X2 benchmark data.
© 2007 - 2016 Samy Al Bahra.