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

Function prof_leakcheck

deps/jemalloc/src/prof.c:1766–1795  ·  view source on GitHub ↗

* See prof_sample_threshold_update() comment for why the body of this function * is conditionally compiled. */

Source from the content-addressed store, hash-verified

1764 * is conditionally compiled.
1765 */
1766static void
1767prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx,
1768 const char *filename) {
1769#ifdef JEMALLOC_PROF
1770 /*
1771 * Scaling is equivalent AdjustSamples() in jeprof, but the result may
1772 * differ slightly from what jeprof reports, because here we scale the
1773 * summary values, whereas jeprof scales each context individually and
1774 * reports the sums of the scaled values.
1775 */
1776 if (cnt_all->curbytes != 0) {
1777 double sample_period = (double)((uint64_t)1 << lg_prof_sample);
1778 double ratio = (((double)cnt_all->curbytes) /
1779 (double)cnt_all->curobjs) / sample_period;
1780 double scale_factor = 1.0 / (1.0 - exp(-ratio));
1781 uint64_t curbytes = (uint64_t)round(((double)cnt_all->curbytes)
1782 * scale_factor);
1783 uint64_t curobjs = (uint64_t)round(((double)cnt_all->curobjs) *
1784 scale_factor);
1785
1786 malloc_printf("<jemalloc>: Leak approximation summary: ~%"FMTu64
1787 " byte%s, ~%"FMTu64" object%s, >= %zu context%s\n",
1788 curbytes, (curbytes != 1) ? "s" : "", curobjs, (curobjs !=
1789 1) ? "s" : "", leak_ngctx, (leak_ngctx != 1) ? "s" : "");
1790 malloc_printf(
1791 "<jemalloc>: Run jeprof on \"%s\" for leak detail\n",
1792 filename);
1793 }
1794#endif
1795}
1796
1797struct prof_gctx_dump_iter_arg_s {
1798 tsdn_t *tsdn;

Callers 1

prof_dumpFunction · 0.70

Calls 1

malloc_printfFunction · 0.70

Tested by

no test coverage detected