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

Function tcache_stats_merge

deps/jemalloc/src/tcache.c:600–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600void
601tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena) {
602 unsigned i;
603
604 cassert(config_stats);
605
606 /* Merge and reset tcache stats. */
607 for (i = 0; i < SC_NBINS; i++) {
608 cache_bin_t *tbin = tcache_small_bin_get(tcache, i);
609 unsigned binshard;
610 bin_t *bin = arena_bin_choose_lock(tsdn, arena, i, &binshard);
611 bin->stats.nrequests += tbin->tstats.nrequests;
612 malloc_mutex_unlock(tsdn, &bin->lock);
613 tbin->tstats.nrequests = 0;
614 }
615
616 for (; i < nhbins; i++) {
617 cache_bin_t *tbin = tcache_large_bin_get(tcache, i);
618 arena_stats_large_flush_nrequests_add(tsdn, &arena->stats, i,
619 tbin->tstats.nrequests);
620 tbin->tstats.nrequests = 0;
621 }
622}
623
624static bool
625tcaches_create_prep(tsd_t *tsd) {

Callers 2

stats_print_atexitFunction · 0.70
tcache_arena_dissociateFunction · 0.70

Calls 3

arena_bin_choose_lockFunction · 0.85
malloc_mutex_unlockFunction · 0.50

Tested by

no test coverage detected