Added lock profiling and output for global locks (ctl, prof and base).

This commit is contained in:
Qi Wang
2017-03-11 20:28:31 -08:00
committed by Qi Wang
parent 0fb5c0e853
commit ca9074deff
9 changed files with 173 additions and 77 deletions

View File

@@ -4,10 +4,13 @@
/* Maximum ctl tree depth. */
#define CTL_MAX_DEPTH 7
#define NUM_ARENA_PROF_LOCKS 6
#define NUM_LOCK_PROF_COUNTERS 7
const char *arena_lock_names[NUM_ARENA_PROF_LOCKS];
const char *lock_counter_names[NUM_LOCK_PROF_COUNTERS];
#define NUM_GLOBAL_PROF_LOCKS 3
#define NUM_ARENA_PROF_LOCKS 6
#define NUM_LOCK_PROF_COUNTERS 7
extern const char *arena_lock_names[NUM_ARENA_PROF_LOCKS];
extern const char *global_lock_names[NUM_GLOBAL_PROF_LOCKS];
extern const char *lock_counter_names[NUM_LOCK_PROF_COUNTERS];
int ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
void *newp, size_t newlen);

View File

@@ -41,6 +41,10 @@ struct ctl_stats_s {
size_t resident;
size_t mapped;
size_t retained;
#define MTX(mutex) lock_prof_data_t mutex##_mtx_data;
GLOBAL_PROF_MUTEXES
#undef MTX
};
struct ctl_arena_s {

View File

@@ -1,6 +1,11 @@
#ifndef JEMALLOC_INTERNAL_CTL_TYPES_H
#define JEMALLOC_INTERNAL_CTL_TYPES_H
#define GLOBAL_PROF_MUTEXES \
MTX(base) \
MTX(ctl) \
MTX(prof)
typedef struct ctl_node_s ctl_node_t;
typedef struct ctl_named_node_s ctl_named_node_t;
typedef struct ctl_indexed_node_s ctl_indexed_node_t;

View File

@@ -106,6 +106,7 @@ bootstrap_calloc
bootstrap_free
bootstrap_malloc
bt_init
bt2gctx_mtx
buferror
ckh_count
ckh_delete

View File

@@ -1,6 +1,8 @@
#ifndef JEMALLOC_INTERNAL_PROF_EXTERNS_H
#define JEMALLOC_INTERNAL_PROF_EXTERNS_H
extern malloc_mutex_t bt2gctx_mtx;
extern bool opt_prof;
extern bool opt_prof_active;
extern bool opt_prof_thread_active_init;