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

Function high_resolution_clockTest

runtime/Perf.cc:1056–1066  ·  view source on GitHub ↗

Measure the cost of reading high precision time

Source from the content-addressed store, hash-verified

1054
1055// Measure the cost of reading high precision time
1056double high_resolution_clockTest() {
1057 int count = 1000000;
1058
1059 uint64_t start = Cycles::rdtsc();
1060 for (int i = 0; i < count; i++) {
1061 std::chrono::high_resolution_clock::now();
1062 }
1063 uint64_t stop = Cycles::rdtsc();
1064
1065 return Cycles::toSeconds(stop - start)/count;
1066}
1067
1068// Measure the cost of printing via ctime
1069double printTime_ctime() {

Callers

nothing calls this directly

Calls 1

rdtscFunction · 0.85

Tested by

no test coverage detected