MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / debugDelay

Function debugDelay

src/debug.cpp:2213–2218  ·  view source on GitHub ↗

Positive input is sleep time in microseconds. Negative input is fractions * of microseconds, i.e. -10 means 100 nanoseconds. */

Source from the content-addressed store, hash-verified

2211/* Positive input is sleep time in microseconds. Negative input is fractions
2212 * of microseconds, i.e. -10 means 100 nanoseconds. */
2213void debugDelay(int usec) {
2214 /* Since even the shortest sleep results in context switch and system call,
2215 * the way we achive short sleeps is by statistically sleeping less often. */
2216 if (usec < 0) usec = (rand() % -usec) == 0 ? 1: 0;
2217 if (usec) usleep(usec);
2218}

Callers 3

rdbSaveKeyValuePairFunction · 0.85
rdbLoadRioFunction · 0.85
loadAppendOnlyFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected