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

Function dictRehashMilliseconds

src/dict.cpp:578–589  ·  view source on GitHub ↗

Rehash in ms+"delta" milliseconds. The value of "delta" is larger * than 0, and is smaller than 1 in most cases. The exact upper bound * depends on the running time of dictRehash(d,100).*/

Source from the content-addressed store, hash-verified

576 * than 0, and is smaller than 1 in most cases. The exact upper bound
577 * depends on the running time of dictRehash(d,100).*/
578int dictRehashMilliseconds(dict *d, int ms) {
579 if (d->pauserehash > 0) return 0;
580
581 long long start = timeInMilliseconds();
582 int rehashes = 0;
583
584 while(dictRehash(d,1000)) {
585 rehashes += 1000;
586 if (timeInMilliseconds()-start > ms) break;
587 }
588 return rehashes;
589}
590
591/* This function performs just a step of rehashing, and only if hashing has
592 * not been paused for our hash table. When we have iterators in the

Callers 3

dictTestFunction · 0.85
endSnapshotAsyncMethod · 0.85
incrementallyRehashMethod · 0.85

Calls 2

timeInMillisecondsFunction · 0.85
dictRehashFunction · 0.85

Tested by

no test coverage detected