Please test rdtsc on various x86-64 hardware (app included)
I'm not doing so well:
$ ./evil-clock-test CPU vendor : AuthenticAMD CPU model : AMD Phenom(tm) 9850 Quad-Core Processor CPU stepping : 3 TSC flags : tsc rdtscp constant_tsc nonstop_tsc Using mfence_rdtsc because you don't have an Intel CPU Will test the "mfence;rdtsc" clock. Now test passed : margin 168 with 15744696 samples Load3 test got no data Load test got no data Store test failed: worst error 10 with 617583 samples
$ ./evil-clock-test CPU vendor : AuthenticAMD CPU model : AMD Phenom(tm) 9850 Quad-Core Processor CPU stepping : 3 TSC flags : tsc rdtscp constant_tsc nonstop_tsc Using mfence_rdtsc because you don't have an Intel CPU Will test the "mfence;rdtsc" clock. Now test passed : margin 168 with 15666016 samples Load3 test got no data Load test got no data Store test got no data
$ ./evil-clock-test CPU vendor : AuthenticAMD CPU model : AMD Phenom(tm) 9850 Quad-Core Processor CPU stepping : 3 TSC flags : tsc rdtscp constant_tsc nonstop_tsc Using mfence_rdtsc because you don't have an Intel CPU Will test the "mfence;rdtsc" clock. Now test passed : margin 168 with 15981720 samples Load3 test got no data Load test got no data Store test got no data
Compiled from git revision 8f7d7a62, "Add script to test all pairs." Running as root makes no difference.
Other programs:
$ ./now_test_all_pairs.sh 0,1: Now test passed : margin 168 with 15007304 samples 0,2: Now test passed : margin 168 with 15288360 samples 0,3: Now test passed : margin 168 with 15539776 samples 1,0: Now test passed : margin 168 with 14890744 samples 1,2: Now test passed : margin 168 with 15266128 samples 1,3: Now test passed : margin 168 with 15322480 samples 2,0: Now test passed : margin 168 with 14978320 samples 2,1: Now test passed : margin 168 with 15109872 samples 2,3: Now test passed : margin 168 with 15207616 samples 3,0: Now test passed : margin 168 with 15043208 samples 3,1: Now test passed : margin 168 with 14686352 samples 3,2: Now test passed : margin 168 with 14945840 samples
$ ./timing_test Usage: time <Miters> <mode> [POSIX clock id]
Clocks are:
0 (CLOCK_REALTIME) resolution = 0.000000001 1 (CLOCK_MONOTONIC) resolution = 0.000000001 5 (CLOCK_REALTIME_COARSE) resolution = 0.010000000 6 (CLOCK_MONOTONIC_COARSE) resolution = 0.010000000
System is 2.6.38.2 with 8 GB ECC RAM. ATI RD790/SB600 chipset.
Hope this helps!
A bit more info on those failing tests (common headers snipped):
$ ./evil-clock-test -v -v -v CPU vendor : AuthenticAMD CPU model : AMD Phenom(tm) 9850 Quad-Core Processor CPU stepping : 3 TSC flags : tsc rdtscp constant_tsc nonstop_tsc Using mfence_rdtsc because you don't have an Intel CPU Will test the "mfence;rdtsc" clock. Running now test... Now test passed : margin 168 with 15176312 samples Running load3 test... Load3 test got no data Running load test... Failed 5/615154 times with worst error 4 Failed 3/618034 times with worst error 4 Failed 4/618552 times with worst error 7 Failed 2/618457 times with worst error 7 Failed 1/618518 times with worst error 4 Failed 2/616455 times with worst error 4 Failed 1/617990 times with worst error 4 Load test failed : worst error 7 with 4323160 samples Running store test... Failed 3/614883 times with worst error 4 Failed 3/616023 times with worst error 4 Failed 6/613633 times with worst error 4 Store test failed: worst error 4 with 1844539 samples
Running now test...
Now test passed : margin 168 with 15125496 samples Running load3 test...
Load3 test got no data
Running load test...
Failed 5/603344 times with worst error 4 Failed 3/609628 times with worst error 4
Load test failed : worst error 4 with 1212972 samples Running store test...
Failed 2/610838 times with worst error 3 Failed 4/611400 times with worst error 4
Store test failed: worst error 4 with 1222238 samples
Running now test...
Now test passed : margin 169 with 15136216 samples Running load3 test...
Load3 test got no data
Running load test...
Load test got no data
Running store test...
Failed 1/617293 times with worst error 4
Store test failed: worst error 4 with 617293 samples
Running now test...
Now test passed : margin 170 with 15128832 samples Running load3 test...
Load3 test got no data
Running load test...
Load test got no data
Running store test...
Store test got no data
Running now test...
Now test passed : margin 170 with 15039712 samples Running load3 test...
Load3 test got no data
Running load test...
Failed 4/617259 times with worst error 4 Failed 4/621375 times with worst error 4
Load test failed : worst error 4 with 1238634 samples Running store test...
Store test got no data
Now test passed : margin 169 with 14977856 samples Running load3 test...
Load3 test got no data
Running load test...
Passed with margin 2 (613724 samples) Failed 7/610443 times with worst error 30
Load test failed : worst error 30 with 1224167 samples Running store test...
Store test got no data
Running now test...
Now test passed : margin 170 with 15131920 samples Running load3 test...
Load3 test got no data
Running load test...
Failed 3/607735 times with worst error 4 Failed 4/614570 times with worst error 4 Failed 1/614801 times with worst error 4 Failed 5/614483 times with worst error 4 Failed 4/614106 times with worst error 4 Failed 1/614649 times with worst error 4 Failed 5/614351 times with worst error 8 Failed 4/614453 times with worst error 4 Failed 4/614643 times with worst error 4
Load test failed : worst error 8 with 5523791 samples Running store test...
Failed 5/613788 times with worst error 4 Failed 1/614285 times with worst error 4
Store test failed: worst error 4 with 1228073 samples