<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Nov 6, 2015, at 2:01 PM, Evan Jones <<a href="mailto:ejones@twitter.com" class="">ejones@twitter.com</a>> wrote:<div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 6, 2015 at 4:57 PM, Jason Evans <span dir="ltr" class=""><<a href="mailto:jasone@canonware.com" target="_blank" class="">jasone@canonware.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class="">On Nov 6, 2015, at 12:53 PM, Evan Jones <<a href="mailto:ejones@twitter.com" target="_blank" class="">ejones@twitter.com</a>> wrote:</span><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 6, 2015 at 3:45 PM, Jason Evans <span dir="ltr" class=""><<a href="mailto:jasone@canonware.com" target="_blank" class="">jasone@canonware.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">No, dumps are always based on the most recent stats reset (process start or "prof.reset" mallctl call). You can view incremental differences between two dumps by using the --base option to jeprof.<br class=""></blockquote><div class=""><br class=""></div><div class="">Is this true if you use opt.lg_prof_interval? Then what is the point of the opt.prof_accum option?</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">opt.lg_prof_interval is merely a dump triggering mechanism. opt.prof_accum controls whether cumulative stats are collected at all.</div></div></div></blockquote><div class=""><br class=""></div><div class="">There must be something stupid that I don't understand then. You said: "dumps are always based on the most recent stats reset", which is usually the process start time, unless you do some manual reset. Does this mean that prof_accum is *only* useful if you do manually trigger resets using mallctl("prof.reset")? Does this mean that with prof_accum:true, the dumps contain *both* the data since the last reset *and* the data since profiling was enabled?</div></div></div></div></div></blockquote><br class=""></div><div>Take the following function as an example, run with MALLOC_CONF=prof:true,prof_accum:true :</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>void<span class="Apple-tab-span" style="white-space:pre"> </span>g(void *p);</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>void</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>f(void) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>unsigned i;</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>for (i = 0; i < (1U << 20); i++) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>void *p = malloc(1U << 30);</div><div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>if (i == (1U << 19)) {</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>mallctl("prof.dump", NULL, NULL, NULL, 0); /* A */</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>mallctl("prof.reset", NULL, NULL, NULL, 0);</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>mallctl("prof.dump", NULL, NULL, NULL, 0); /* B */</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if (p != NULL) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>g(p);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>free(p);</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mallctl("prof.dump", NULL, NULL, NULL, 0); /* C */</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br class=""></div><div>What will the heap profiling stats (as interpreted by jeprof) dumped at A, B, and C say regarding the malloc() site in f()?</div><div><br class=""></div><div><div>A:</div><div> - Current: ~1 object, ~2^30 bytes</div><div> - Cumulative: ~2^19 objects, ~2^49 bytes</div><div><div>B:</div><div> - Current: 0 objects, 0 bytes</div><div> - Cumulative: 0 objects, 0 bytes</div></div></div><div>C:</div><div> - Current: 0 objects, 0 bytes</div><div> - Cumulative: ~2^19 objects, ~2^49 bytes</div><div><br class=""></div><div>opt.prof_accum controls whether jemalloc maintains the cumulative stats. With MALLOC_CONF=prof:true,prof_accum:false, you will get no cumulative stats at all, no matter when/whether any resets occurred.</div><div><br class=""></div><div>Jason</div></body></html>