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

Function delayInBenchmark

runtime/Perf.cc:407–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407double delayInBenchmark() {
408 int count = 1000000;
409 uint64_t x = 0;
410 uint64_t start = Cycles::rdtsc();
411 for (int i = 0; i < count; i++) {
412 function(0);
413 }
414 uint64_t stop = Cycles::rdtsc();
415
416 discard(&cntr);
417 return Cycles::toSeconds(stop - start)/(count);
418}
419
420// Measure the cost of a 32-bit divide. Divides don't take a constant
421// number of cycles. Values were chosen here semi-randomly to depict a

Callers

nothing calls this directly

Calls 3

rdtscFunction · 0.85
functionFunction · 0.70
discardFunction · 0.70

Tested by

no test coverage detected