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

Function background_work_sleep_once

deps/jemalloc/src/background_thread.c:285–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285static inline void
286background_work_sleep_once(tsdn_t *tsdn, background_thread_info_t *info, unsigned ind) {
287 uint64_t min_interval = BACKGROUND_THREAD_INDEFINITE_SLEEP;
288 unsigned narenas = narenas_total_get();
289
290 for (unsigned i = ind; i < narenas; i += max_background_threads) {
291 arena_t *arena = arena_get(tsdn, i, false);
292 if (!arena) {
293 continue;
294 }
295 arena_decay(tsdn, arena, true, false);
296 if (min_interval == BACKGROUND_THREAD_MIN_INTERVAL_NS) {
297 /* Min interval will be used. */
298 continue;
299 }
300 uint64_t interval = arena_decay_compute_purge_interval(tsdn,
301 arena);
302 assert(interval >= BACKGROUND_THREAD_MIN_INTERVAL_NS);
303 if (min_interval > interval) {
304 min_interval = interval;
305 }
306 }
307 background_thread_sleep(tsdn, info, min_interval);
308}
309
310static bool
311background_threads_disable_single(tsd_t *tsd, background_thread_info_t *info) {

Callers 2

background_thread0_workFunction · 0.70
background_workFunction · 0.70

Calls 5

narenas_total_getFunction · 0.70
arena_decayFunction · 0.70
background_thread_sleepFunction · 0.70
arena_getFunction · 0.50

Tested by

no test coverage detected