Initialize prof idump counter once rather than once per arena

This commit is contained in:
Yinan Zhang 2020-04-15 12:21:38 -07:00
parent e10e5059e8
commit 8be5584494
3 changed files with 6 additions and 9 deletions

View File

@ -74,7 +74,6 @@ void prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs,
#endif
int prof_getpid(void);
void prof_get_default_filename(tsdn_t *tsdn, char *filename, uint64_t ind);
bool prof_accum_init(void);
bool prof_idump_accum(tsdn_t *tsdn, uint64_t accumbytes);
void prof_idump(tsdn_t *tsdn);
bool prof_mdump(tsd_t *tsd, const char *filename);

View File

@ -1463,12 +1463,6 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
}
}
if (config_prof) {
if (prof_accum_init()) {
goto label_error;
}
}
atomic_store_u(&arena->dss_prec, (unsigned)extent_dss_prec_get(),
ATOMIC_RELAXED);

View File

@ -641,8 +641,8 @@ prof_fdump(void) {
prof_dump(tsd, false, filename, opt_prof_leak);
}
bool
prof_accum_init(void) {
static bool
prof_idump_accum_init(void) {
cassert(config_prof);
return counter_accum_init(&prof_idump_accumulated, prof_interval);
@ -1021,6 +1021,10 @@ prof_boot2(tsd_t *tsd, base_t *base) {
return true;
}
if (prof_idump_accum_init()) {
return true;
}
if (malloc_mutex_init(&prof_dump_filename_mtx, "prof_dump_filename",
WITNESS_RANK_PROF_DUMP_FILENAME, malloc_mutex_rank_exclusive)) {
return true;