MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / rdtscTest

Function rdtscTest

runtime/Perf.cc:1041–1053  ·  view source on GitHub ↗

Measure the cost of reading the fine-grain cycle counter.

Source from the content-addressed store, hash-verified

1039
1040// Measure the cost of reading the fine-grain cycle counter.
1041double 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
1056double high_resolution_clockTest() {

Callers

nothing calls this directly

Calls 1

rdtscFunction · 0.85

Tested by

no test coverage detected