MCPcopy Create free account
hub / github.com/F-Stack/f-stack / stats_mutexes_reset_ctl

Function stats_mutexes_reset_ctl

app/redis-6.2.6/deps/jemalloc/src/ctl.c:2767–2816  ·  view source on GitHub ↗

Resets all mutex stats, including global, arena and bin mutexes. */

Source from the content-addressed store, hash-verified

2765
2766/* Resets all mutex stats, including global, arena and bin mutexes. */
2767static int
2768stats_mutexes_reset_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
2769 void *oldp, size_t *oldlenp, void *newp, size_t newlen) {
2770 if (!config_stats) {
2771 return ENOENT;
2772 }
2773
2774 tsdn_t *tsdn = tsd_tsdn(tsd);
2775
2776#define MUTEX_PROF_RESET(mtx) \
2777 malloc_mutex_lock(tsdn, &mtx); \
2778 malloc_mutex_prof_data_reset(tsdn, &mtx); \
2779 malloc_mutex_unlock(tsdn, &mtx);
2780
2781 /* Global mutexes: ctl and prof. */
2782 MUTEX_PROF_RESET(ctl_mtx);
2783 if (have_background_thread) {
2784 MUTEX_PROF_RESET(background_thread_lock);
2785 }
2786 if (config_prof && opt_prof) {
2787 MUTEX_PROF_RESET(bt2gctx_mtx);
2788 }
2789
2790
2791 /* Per arena mutexes. */
2792 unsigned n = narenas_total_get();
2793
2794 for (unsigned i = 0; i < n; i++) {
2795 arena_t *arena = arena_get(tsdn, i, false);
2796 if (!arena) {
2797 continue;
2798 }
2799 MUTEX_PROF_RESET(arena->large_mtx);
2800 MUTEX_PROF_RESET(arena->extent_avail_mtx);
2801 MUTEX_PROF_RESET(arena->extents_dirty.mtx);
2802 MUTEX_PROF_RESET(arena->extents_muzzy.mtx);
2803 MUTEX_PROF_RESET(arena->extents_retained.mtx);
2804 MUTEX_PROF_RESET(arena->decay_dirty.mtx);
2805 MUTEX_PROF_RESET(arena->decay_muzzy.mtx);
2806 MUTEX_PROF_RESET(arena->tcache_ql_mtx);
2807 MUTEX_PROF_RESET(arena->base->mtx);
2808
2809 for (szind_t i = 0; i < NBINS; i++) {
2810 bin_t *bin = &arena->bins[i];
2811 MUTEX_PROF_RESET(bin->lock);
2812 }
2813 }
2814#undef MUTEX_PROF_RESET
2815 return 0;
2816}
2817
2818CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nmalloc,
2819 arenas_i(mib[2])->astats->bstats[mib[4]].nmalloc, uint64_t)

Callers

nothing calls this directly

Calls 3

tsd_tsdnFunction · 0.85
narenas_total_getFunction · 0.85
arena_getFunction · 0.85

Tested by

no test coverage detected