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

Method sleep

runtime/Cycles.cc:220–225  ·  view source on GitHub ↗

* Busy wait for a given number of microseconds. * Callers should use this method in most reasonable cases as opposed to * usleep for accurate measurements. Calling usleep may put the the processor * in a low power mode/sleep state which reduces the clock frequency. * So, each time the process/thread wakes up from usleep, it takes some time * to ramp up to maximum frequency. Thus meausrements

Source from the content-addressed store, hash-verified

218 * Number of microseconds.
219 */
220void
221Cycles::sleep(uint64_t us)
222{
223 uint64_t stop = Cycles::rdtsc() + Cycles::fromNanoseconds(1000*us);
224 while (Cycles::rdtsc() < stop);
225}
226} // end PerfUtils

Callers

nothing calls this directly

Calls 1

rdtscFunction · 0.85

Tested by

no test coverage detected