diff options
author | Jason Evans <je@facebook.com> | 2010-04-01 00:35:51 (GMT) |
---|---|---|
committer | Jason Evans <je@facebook.com> | 2010-04-01 00:35:51 (GMT) |
commit | a02fc08ec9dd8479a6430155b6a433da09f6ff10 (patch) | |
tree | f4008e4a620301de2326c9ec84ae0bfcca237c80 /jemalloc/src | |
parent | 0b270a991dd7822b7c7e13d9219f235a5dde9fdf (diff) | |
download | jemalloc-a02fc08ec9dd8479a6430155b6a433da09f6ff10.zip jemalloc-a02fc08ec9dd8479a6430155b6a433da09f6ff10.tar.gz jemalloc-a02fc08ec9dd8479a6430155b6a433da09f6ff10.tar.bz2 |
Make interval-triggered profile dumping optional.
Make it possible to disable interval-triggered profile dumping, even if
profiling is enabled. This is useful if the user only wants a single
dump at exit, or if the application manually triggers profile dumps.
Diffstat (limited to 'jemalloc/src')
-rw-r--r-- | jemalloc/src/ctl.c | 2 | ||||
-rw-r--r-- | jemalloc/src/jemalloc.c | 2 | ||||
-rw-r--r-- | jemalloc/src/prof.c | 11 | ||||
-rw-r--r-- | jemalloc/src/stats.c | 13 |
4 files changed, 18 insertions, 10 deletions
diff --git a/jemalloc/src/ctl.c b/jemalloc/src/ctl.c index 2249102..f628c13 100644 --- a/jemalloc/src/ctl.c +++ b/jemalloc/src/ctl.c @@ -1153,7 +1153,7 @@ CTL_RO_GEN(opt_lg_tcache_gc_sweep, opt_lg_tcache_gc_sweep, ssize_t) CTL_RO_GEN(opt_prof, opt_prof, bool) CTL_RO_GEN(opt_lg_prof_bt_max, opt_lg_prof_bt_max, size_t) CTL_RO_GEN(opt_lg_prof_sample, opt_lg_prof_sample, size_t) -CTL_RO_GEN(opt_lg_prof_interval, opt_lg_prof_interval, size_t) +CTL_RO_GEN(opt_lg_prof_interval, opt_lg_prof_interval, ssize_t) CTL_RO_GEN(opt_prof_udump, opt_prof_udump, bool) CTL_RO_GEN(opt_prof_leak, opt_prof_leak, bool) #endif diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c index b30f231..d3c7cca 100644 --- a/jemalloc/src/jemalloc.c +++ b/jemalloc/src/jemalloc.c @@ -486,7 +486,7 @@ MALLOC_OUT: #endif #ifdef JEMALLOC_PROF case 'i': - if (opt_lg_prof_interval > 0) + if (opt_lg_prof_interval >= 0) opt_lg_prof_interval--; break; case 'I': diff --git a/jemalloc/src/prof.c b/jemalloc/src/prof.c index 80c81da..97db422 100644 --- a/jemalloc/src/prof.c +++ b/jemalloc/src/prof.c @@ -20,7 +20,7 @@ bool opt_prof = false; size_t opt_lg_prof_bt_max = LG_PROF_BT_MAX_DEFAULT; size_t opt_lg_prof_sample = LG_PROF_SAMPLE_DEFAULT; -size_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT; +ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT; bool opt_prof_udump = false; bool opt_prof_leak = false; @@ -1271,8 +1271,13 @@ prof_boot0(void) opt_prof = true; opt_prof_udump = false; prof_interval = 0; - } else if (opt_prof) - prof_interval = (((uint64_t)1U) << opt_lg_prof_interval); + } else if (opt_prof) { + if (opt_lg_prof_interval >= 0) { + prof_interval = (((uint64_t)1U) << + opt_lg_prof_interval); + } else + prof_interval = 0; + } prof_promote = (opt_prof && opt_lg_prof_sample > PAGE_SHIFT); } diff --git a/jemalloc/src/stats.c b/jemalloc/src/stats.c index a5ec1f1..60e75bc 100644 --- a/jemalloc/src/stats.c +++ b/jemalloc/src/stats.c @@ -582,12 +582,15 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque, write_cb(cbopaque, umax2s(sv, 10, s)); write_cb(cbopaque, ")\n"); - CTL_GET("opt.lg_prof_interval", &sv, size_t); + CTL_GET("opt.lg_prof_interval", &ssv, ssize_t); write_cb(cbopaque, "Average profile dump interval: "); - write_cb(cbopaque, umax2s((1U << sv), 10, s)); - write_cb(cbopaque, " (2^"); - write_cb(cbopaque, umax2s(sv, 10, s)); - write_cb(cbopaque, ")\n"); + if (ssv >= 0) { + write_cb(cbopaque, umax2s((1U << ssv), 10, s)); + write_cb(cbopaque, " (2^"); + write_cb(cbopaque, umax2s(ssv, 10, s)); + write_cb(cbopaque, ")\n"); + } else + write_cb(cbopaque, "N/A\n"); } CTL_GET("arenas.chunksize", &sv, size_t); write_cb(cbopaque, "Chunk size: "); |