diff --git a/include/jemalloc/internal/prof_externs.h b/include/jemalloc/internal/prof_externs.h index 86f4193a..6d296920 100644 --- a/include/jemalloc/internal/prof_externs.h +++ b/include/jemalloc/internal/prof_externs.h @@ -3,24 +3,24 @@ #include "jemalloc/internal/mutex.h" -extern malloc_mutex_t bt2gctx_mtx; -extern malloc_mutex_t tdatas_mtx; -extern malloc_mutex_t prof_dump_mtx; +extern malloc_mutex_t bt2gctx_mtx; +extern malloc_mutex_t tdatas_mtx; +extern malloc_mutex_t prof_dump_mtx; malloc_mutex_t *prof_gctx_mutex_choose(void); malloc_mutex_t *prof_tdata_mutex_choose(uint64_t thr_uid); -extern bool opt_prof; -extern bool opt_prof_active; -extern bool opt_prof_thread_active_init; -extern size_t opt_lg_prof_sample; /* Mean bytes between samples. */ -extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */ -extern bool opt_prof_gdump; /* High-water memory dumping. */ -extern bool opt_prof_final; /* Final profile dumping. */ -extern bool opt_prof_leak; /* Dump leak summary at exit. */ -extern bool opt_prof_accum; /* Report cumulative bytes. */ -extern bool opt_prof_log; /* Turn logging on at boot. */ -extern char opt_prof_prefix[ +extern bool opt_prof; +extern bool opt_prof_active; +extern bool opt_prof_thread_active_init; +extern size_t opt_lg_prof_sample; /* Mean bytes between samples. */ +extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */ +extern bool opt_prof_gdump; /* High-water memory dumping. */ +extern bool opt_prof_final; /* Final profile dumping. */ +extern bool opt_prof_leak; /* Dump leak summary at exit. */ +extern bool opt_prof_accum; /* Report cumulative bytes. */ +extern bool opt_prof_log; /* Turn logging on at boot. */ +extern char opt_prof_prefix[ /* Minimize memory bloat for non-prof builds. */ #ifdef JEMALLOC_PROF PATH_MAX + @@ -28,21 +28,21 @@ extern char opt_prof_prefix[ 1]; /* Accessed via prof_active_[gs]et{_unlocked,}(). */ -extern bool prof_active; +extern bool prof_active; /* Accessed via prof_gdump_[gs]et{_unlocked,}(). */ -extern bool prof_gdump_val; +extern bool prof_gdump_val; /* Profile dump interval, measured in bytes allocated. */ -extern uint64_t prof_interval; +extern uint64_t prof_interval; /* * Initialized as opt_lg_prof_sample, and potentially modified during profiling * resets. */ -extern size_t lg_prof_sample; +extern size_t lg_prof_sample; -extern bool prof_booted; +extern bool prof_booted; /* Functions only accessed in prof_inlines_a.h */ bool prof_idump_accum_impl(tsdn_t *tsdn, uint64_t accumbytes); diff --git a/src/prof.c b/src/prof.c index 3be461bc..a9849b05 100644 --- a/src/prof.c +++ b/src/prof.c @@ -34,44 +34,44 @@ /******************************************************************************/ /* Data. */ -bool opt_prof = false; -bool opt_prof_active = true; -bool opt_prof_thread_active_init = true; -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; -bool opt_prof_final = false; -bool opt_prof_leak = false; -bool opt_prof_accum = false; -char opt_prof_prefix[PROF_DUMP_FILENAME_LEN]; +bool opt_prof = false; +bool opt_prof_active = true; +bool opt_prof_thread_active_init = true; +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; +bool opt_prof_final = false; +bool opt_prof_leak = false; +bool opt_prof_accum = false; +char opt_prof_prefix[PROF_DUMP_FILENAME_LEN]; /* Accessed via prof_idump_[accum/rollback](). */ -static prof_accum_t prof_idump_accumulated; +static prof_accum_t prof_idump_accumulated; /* * Initialized as opt_prof_active, and accessed via * prof_active_[gs]et{_unlocked,}(). */ -bool prof_active; -static malloc_mutex_t prof_active_mtx; +bool prof_active; +static malloc_mutex_t prof_active_mtx; /* * Initialized as opt_prof_thread_active_init, and accessed via * prof_thread_active_init_[gs]et(). */ -static bool prof_thread_active_init; -static malloc_mutex_t prof_thread_active_init_mtx; +static bool prof_thread_active_init; +static malloc_mutex_t prof_thread_active_init_mtx; /* * Initialized as opt_prof_gdump, and accessed via * prof_gdump_[gs]et{_unlocked,}(). */ -bool prof_gdump_val; -static malloc_mutex_t prof_gdump_mtx; +bool prof_gdump_val; +static malloc_mutex_t prof_gdump_mtx; -uint64_t prof_interval = 0; +uint64_t prof_interval = 0; -size_t lg_prof_sample; +size_t lg_prof_sample; /* * Table of mutexes that are shared among gctx's. These are leaf locks, so @@ -80,8 +80,8 @@ size_t lg_prof_sample; * and destroying mutexes causes complications for systems that allocate when * creating/destroying mutexes. */ -static malloc_mutex_t *gctx_locks; -static atomic_u_t cum_gctxs; /* Atomic counter. */ +static malloc_mutex_t *gctx_locks; +static atomic_u_t cum_gctxs; /* Atomic counter. */ /* * Table of mutexes that are shared among tdata's. No operations require @@ -89,27 +89,27 @@ static atomic_u_t cum_gctxs; /* Atomic counter. */ * than one tdata at the same time, even though a gctx lock may be acquired * while holding a tdata lock. */ -static malloc_mutex_t *tdata_locks; +static malloc_mutex_t *tdata_locks; /* Non static to enable profiling. */ -malloc_mutex_t bt2gctx_mtx; +malloc_mutex_t bt2gctx_mtx; -malloc_mutex_t tdatas_mtx; +malloc_mutex_t tdatas_mtx; -static uint64_t next_thr_uid; -static malloc_mutex_t next_thr_uid_mtx; +static uint64_t next_thr_uid; +static malloc_mutex_t next_thr_uid_mtx; -static malloc_mutex_t prof_dump_filename_mtx; -static uint64_t prof_dump_seq; -static uint64_t prof_dump_iseq; -static uint64_t prof_dump_mseq; -static uint64_t prof_dump_useq; +static malloc_mutex_t prof_dump_filename_mtx; +static uint64_t prof_dump_seq; +static uint64_t prof_dump_iseq; +static uint64_t prof_dump_mseq; +static uint64_t prof_dump_useq; -malloc_mutex_t prof_dump_mtx; -static char *prof_dump_prefix = NULL; +malloc_mutex_t prof_dump_mtx; +static char *prof_dump_prefix = NULL; /* Do not dump any profiles until bootstrapping is complete. */ -bool prof_booted = false; +bool prof_booted = false; /******************************************************************************/ @@ -550,8 +550,8 @@ prof_dump_prefix_is_empty(tsdn_t *tsdn) { return ret; } -#define DUMP_FILENAME_BUFSIZE (PATH_MAX + 1) -#define VSEQ_INVALID UINT64_C(0xffffffffffffffff) +#define DUMP_FILENAME_BUFSIZE (PATH_MAX + 1) +#define VSEQ_INVALID UINT64_C(0xffffffffffffffff) static void prof_dump_filename(tsd_t *tsd, char *filename, char v, uint64_t vseq) { cassert(config_prof); diff --git a/src/prof_data.c b/src/prof_data.c index 1b321528..ecabed3e 100644 --- a/src/prof_data.c +++ b/src/prof_data.c @@ -29,19 +29,19 @@ * Global hash of (prof_bt_t *)-->(prof_gctx_t *). This is the master data * structure that knows about all backtraces currently captured. */ -static ckh_t bt2gctx; +static ckh_t bt2gctx; /* * Tree of all extant prof_tdata_t structures, regardless of state, * {attached,detached,expired}. */ -static prof_tdata_tree_t tdatas; +static prof_tdata_tree_t tdatas; /* * This buffer is rather large for stack allocation, so use a single buffer for * all profile dumps. */ -static char prof_dump_buf[ +static char prof_dump_buf[ /* Minimize memory bloat for non-prof builds. */ #ifdef JEMALLOC_PROF PROF_DUMP_BUFSIZE @@ -49,8 +49,8 @@ static char prof_dump_buf[ 1 #endif ]; -static size_t prof_dump_buf_end; -static int prof_dump_fd; +static size_t prof_dump_buf_end; +static int prof_dump_fd; /******************************************************************************/ /* Red-black trees. */