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

Function prof_dump_prep

app/redis-6.2.6/deps/jemalloc/src/prof.c:1551–1591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1549}
1550
1551static void
1552prof_dump_prep(tsd_t *tsd, prof_tdata_t *tdata,
1553 struct prof_tdata_merge_iter_arg_s *prof_tdata_merge_iter_arg,
1554 struct prof_gctx_merge_iter_arg_s *prof_gctx_merge_iter_arg,
1555 prof_gctx_tree_t *gctxs) {
1556 size_t tabind;
1557 union {
1558 prof_gctx_t *p;
1559 void *v;
1560 } gctx;
1561
1562 prof_enter(tsd, tdata);
1563
1564 /*
1565 * Put gctx's in limbo and clear their counters in preparation for
1566 * summing.
1567 */
1568 gctx_tree_new(gctxs);
1569 for (tabind = 0; !ckh_iter(&bt2gctx, &tabind, NULL, &gctx.v);) {
1570 prof_dump_gctx_prep(tsd_tsdn(tsd), gctx.p, gctxs);
1571 }
1572
1573 /*
1574 * Iterate over tdatas, and for the non-expired ones snapshot their tctx
1575 * stats and merge them into the associated gctx's.
1576 */
1577 prof_tdata_merge_iter_arg->tsdn = tsd_tsdn(tsd);
1578 memset(&prof_tdata_merge_iter_arg->cnt_all, 0, sizeof(prof_cnt_t));
1579 malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
1580 tdata_tree_iter(&tdatas, NULL, prof_tdata_merge_iter,
1581 (void *)prof_tdata_merge_iter_arg);
1582 malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
1583
1584 /* Merge tctx stats into gctx's. */
1585 prof_gctx_merge_iter_arg->tsdn = tsd_tsdn(tsd);
1586 prof_gctx_merge_iter_arg->leak_ngctx = 0;
1587 gctx_tree_iter(gctxs, NULL, prof_gctx_merge_iter,
1588 (void *)prof_gctx_merge_iter_arg);
1589
1590 prof_leave(tsd, tdata);
1591}
1592
1593static bool
1594prof_dump_file(tsd_t *tsd, bool propagate_err, const char *filename,

Callers 2

prof_dumpFunction · 0.85
prof_cnt_allFunction · 0.85

Calls 8

prof_enterFunction · 0.85
ckh_iterFunction · 0.85
prof_dump_gctx_prepFunction · 0.85
tsd_tsdnFunction · 0.85
memsetFunction · 0.85
malloc_mutex_lockFunction · 0.85
malloc_mutex_unlockFunction · 0.85
prof_leaveFunction · 0.85

Tested by

no test coverage detected