Measure the cost of reading the fine-grain cycle counter.
| 1039 | |
| 1040 | // Measure the cost of reading the fine-grain cycle counter. |
| 1041 | double rdtscTest() |
| 1042 | { |
| 1043 | uint64_t total = 0; |
| 1044 | int count = 1000000; |
| 1045 | |
| 1046 | uint64_t start = Cycles::rdtsc(); |
| 1047 | for (int i = 0; i < count; i++) { |
| 1048 | total += Cycles::rdtsc(); |
| 1049 | } |
| 1050 | uint64_t stop = Cycles::rdtsc(); |
| 1051 | |
| 1052 | return Cycles::toSeconds(stop - start)/count; |
| 1053 | } |
| 1054 | |
| 1055 | // Measure the cost of reading high precision time |
| 1056 | double high_resolution_clockTest() { |