Avoid arena_prof_accum()-related locking when possible.

Refactor arena_prof_accum() and its callers to avoid arena locking when
prof_interval is 0 (as when profiling is disabled).

Reported by Ben Maurer.
This commit is contained in:
Jason Evans
2012-11-13 12:56:27 -08:00
parent 556ddc7fa9
commit a3b3386ddd
5 changed files with 50 additions and 36 deletions

View File

@@ -26,7 +26,7 @@ bool opt_prof_leak = false;
bool opt_prof_accum = false;
char opt_prof_prefix[PATH_MAX + 1];
uint64_t prof_interval;
uint64_t prof_interval = 0;
bool prof_promote;
/*
@@ -1206,13 +1206,11 @@ prof_boot1(void)
*/
opt_prof = true;
opt_prof_gdump = false;
prof_interval = 0;
} 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 > LG_PAGE);