Measure the cost of the Cycles::toSeconds method.
| 899 | |
| 900 | // Measure the cost of the Cycles::toSeconds method. |
| 901 | double perfCyclesToSeconds() |
| 902 | { |
| 903 | int count = 1000000; |
| 904 | double total = 0; |
| 905 | uint64_t cycles = 994261; |
| 906 | |
| 907 | uint64_t start = Cycles::rdtsc(); |
| 908 | for (int i = 0; i < count; i++) { |
| 909 | total += Cycles::toSeconds(cycles); |
| 910 | } |
| 911 | uint64_t stop = Cycles::rdtsc(); |
| 912 | |
| 913 | return Cycles::toSeconds(stop - start)/count; |
| 914 | } |
| 915 | |
| 916 | // Measure the cost of the reading the CPU timestamp counter |
| 917 | double rdtsc_test() |