Remove the opt.lg_prof_bt_max option.
Remove opt.lg_prof_bt_max, and hard code it to 7. The original intention of this option was to enable faster backtracing by limiting backtrace depth. However, this makes graphical pprof output very difficult to interpret. In practice, decreasing sampling frequency is a better mechanism for limiting profiling overhead.
This commit is contained in:
@@ -74,7 +74,6 @@ CTL_PROTO(opt_lg_tcache_gc_sweep)
|
||||
CTL_PROTO(opt_prof)
|
||||
CTL_PROTO(opt_prof_prefix)
|
||||
CTL_PROTO(opt_prof_active)
|
||||
CTL_PROTO(opt_lg_prof_bt_max)
|
||||
CTL_PROTO(opt_lg_prof_sample)
|
||||
CTL_PROTO(opt_lg_prof_interval)
|
||||
CTL_PROTO(opt_prof_gdump)
|
||||
@@ -216,7 +215,6 @@ static const ctl_node_t opt_node[] = {
|
||||
{NAME("prof"), CTL(opt_prof)},
|
||||
{NAME("prof_prefix"), CTL(opt_prof_prefix)},
|
||||
{NAME("prof_active"), CTL(opt_prof_active)},
|
||||
{NAME("lg_prof_bt_max"), CTL(opt_lg_prof_bt_max)},
|
||||
{NAME("lg_prof_sample"), CTL(opt_lg_prof_sample)},
|
||||
{NAME("lg_prof_interval"), CTL(opt_lg_prof_interval)},
|
||||
{NAME("prof_gdump"), CTL(opt_prof_gdump)},
|
||||
@@ -1125,7 +1123,6 @@ CTL_RO_NL_CGEN(config_tcache, opt_lg_tcache_gc_sweep, opt_lg_tcache_gc_sweep,
|
||||
CTL_RO_NL_CGEN(config_prof, opt_prof, opt_prof, bool)
|
||||
CTL_RO_NL_CGEN(config_prof, opt_prof_prefix, opt_prof_prefix, const char *)
|
||||
CTL_RO_CGEN(config_prof, opt_prof_active, opt_prof_active, bool) /* Mutable. */
|
||||
CTL_RO_NL_CGEN(config_prof, opt_lg_prof_bt_max, opt_lg_prof_bt_max, size_t)
|
||||
CTL_RO_NL_CGEN(config_prof, opt_lg_prof_sample, opt_lg_prof_sample, size_t)
|
||||
CTL_RO_NL_CGEN(config_prof, opt_lg_prof_interval, opt_lg_prof_interval, ssize_t)
|
||||
CTL_RO_NL_CGEN(config_prof, opt_prof_gdump, opt_prof_gdump, bool)
|
||||
|
@@ -597,8 +597,6 @@ malloc_conf_init(void)
|
||||
if (config_prof) {
|
||||
CONF_HANDLE_BOOL(prof)
|
||||
CONF_HANDLE_CHAR_P(prof_prefix, "jeprof")
|
||||
CONF_HANDLE_SIZE_T(lg_prof_bt_max, 0,
|
||||
LG_PROF_BT_MAX)
|
||||
CONF_HANDLE_BOOL(prof_active)
|
||||
CONF_HANDLE_SSIZE_T(lg_prof_sample, 0,
|
||||
(sizeof(uint64_t) << 3) - 1)
|
||||
|
22
src/prof.c
22
src/prof.c
@@ -16,7 +16,6 @@
|
||||
|
||||
bool opt_prof = false;
|
||||
bool opt_prof_active = true;
|
||||
size_t opt_lg_prof_bt_max = LG_PROF_BT_MAX_DEFAULT;
|
||||
size_t opt_lg_prof_sample = LG_PROF_SAMPLE_DEFAULT;
|
||||
ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT;
|
||||
bool opt_prof_gdump = false;
|
||||
@@ -27,8 +26,6 @@ char opt_prof_prefix[PATH_MAX + 1];
|
||||
uint64_t prof_interval;
|
||||
bool prof_promote;
|
||||
|
||||
unsigned prof_bt_max;
|
||||
|
||||
#ifndef NO_TLS
|
||||
__thread prof_tdata_t *prof_tdata_tls
|
||||
JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
@@ -179,7 +176,7 @@ prof_leave(void)
|
||||
|
||||
#ifdef JEMALLOC_PROF_LIBUNWIND
|
||||
void
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore)
|
||||
{
|
||||
unw_context_t uc;
|
||||
unw_cursor_t cursor;
|
||||
@@ -189,7 +186,6 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
cassert(config_prof);
|
||||
assert(bt->len == 0);
|
||||
assert(bt->vec != NULL);
|
||||
assert(max <= (1U << opt_lg_prof_bt_max));
|
||||
|
||||
unw_getcontext(&uc);
|
||||
unw_init_local(&cursor, &uc);
|
||||
@@ -205,7 +201,7 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
* Iterate over stack frames until there are no more, or until no space
|
||||
* remains in bt.
|
||||
*/
|
||||
for (i = 0; i < max; i++) {
|
||||
for (i = 0; i < PROF_BT_MAX; i++) {
|
||||
unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *)&bt->vec[i]);
|
||||
bt->len++;
|
||||
err = unw_step(&cursor);
|
||||
@@ -243,9 +239,9 @@ prof_unwind_callback(struct _Unwind_Context *context, void *arg)
|
||||
}
|
||||
|
||||
void
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore)
|
||||
{
|
||||
prof_unwind_data_t data = {bt, nignore, max};
|
||||
prof_unwind_data_t data = {bt, nignore, PROF_BT_MAX};
|
||||
|
||||
cassert(config_prof);
|
||||
|
||||
@@ -253,10 +249,10 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
}
|
||||
#elif (defined(JEMALLOC_PROF_GCC))
|
||||
void
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore)
|
||||
{
|
||||
#define BT_FRAME(i) \
|
||||
if ((i) < nignore + max) { \
|
||||
if ((i) < nignore + PROF_BT_MAX) { \
|
||||
void *p; \
|
||||
if (__builtin_frame_address(i) == 0) \
|
||||
return; \
|
||||
@@ -272,7 +268,6 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
|
||||
cassert(config_prof);
|
||||
assert(nignore <= 3);
|
||||
assert(max <= (1U << opt_lg_prof_bt_max));
|
||||
|
||||
BT_FRAME(0)
|
||||
BT_FRAME(1)
|
||||
@@ -423,7 +418,7 @@ prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
}
|
||||
#else
|
||||
void
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore, unsigned max)
|
||||
prof_backtrace(prof_bt_t *bt, unsigned nignore)
|
||||
{
|
||||
|
||||
cassert(config_prof);
|
||||
@@ -1168,7 +1163,7 @@ prof_tdata_init(void)
|
||||
}
|
||||
ql_new(&prof_tdata->lru_ql);
|
||||
|
||||
prof_tdata->vec = imalloc(sizeof(void *) * prof_bt_max);
|
||||
prof_tdata->vec = imalloc(sizeof(void *) * PROF_BT_MAX);
|
||||
if (prof_tdata->vec == NULL) {
|
||||
ckh_delete(&prof_tdata->bt2cnt);
|
||||
idalloc(prof_tdata);
|
||||
@@ -1270,7 +1265,6 @@ prof_boot2(void)
|
||||
abort();
|
||||
}
|
||||
|
||||
prof_bt_max = (1U << opt_lg_prof_bt_max);
|
||||
if (malloc_mutex_init(&prof_dump_seq_mtx))
|
||||
return (true);
|
||||
|
||||
|
@@ -511,7 +511,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
OPT_WRITE_SSIZE_T(lg_tcache_max)
|
||||
OPT_WRITE_BOOL(prof)
|
||||
OPT_WRITE_CHAR_P(prof_prefix)
|
||||
OPT_WRITE_SIZE_T(lg_prof_bt_max)
|
||||
OPT_WRITE_BOOL(prof_active)
|
||||
OPT_WRITE_SSIZE_T(lg_prof_sample)
|
||||
OPT_WRITE_BOOL(prof_accum)
|
||||
@@ -616,11 +615,6 @@ stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
}
|
||||
if ((err = JEMALLOC_P(mallctl)("opt.prof", &bv, &bsz, NULL, 0))
|
||||
== 0 && bv) {
|
||||
CTL_GET("opt.lg_prof_bt_max", &sv, size_t);
|
||||
write_cb(cbopaque, "Maximum profile backtrace depth: ");
|
||||
write_cb(cbopaque, u2s((1U << sv), 10, s));
|
||||
write_cb(cbopaque, "\n");
|
||||
|
||||
CTL_GET("opt.lg_prof_sample", &sv, size_t);
|
||||
write_cb(cbopaque, "Average profile sample interval: ");
|
||||
write_cb(cbopaque, u2s((((uint64_t)1U) << sv), 10, s));
|
||||
|
Reference in New Issue
Block a user