2017-04-21 04:38:12 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_STATS_H
|
|
|
|
#define JEMALLOC_INTERNAL_STATS_H
|
2010-01-17 01:53:50 +08:00
|
|
|
|
2017-05-28 06:35:36 +08:00
|
|
|
/* OPTION(opt, var_name, default, set_value_to) */
|
|
|
|
#define STATS_PRINT_OPTIONS \
|
|
|
|
OPTION('J', json, false, true) \
|
|
|
|
OPTION('g', general, true, false) \
|
|
|
|
OPTION('m', merged, config_stats, false) \
|
|
|
|
OPTION('d', destroyed, config_stats, false) \
|
|
|
|
OPTION('a', unmerged, config_stats, false) \
|
|
|
|
OPTION('b', bins, true, false) \
|
|
|
|
OPTION('l', large, true, false) \
|
2018-08-01 00:49:49 +08:00
|
|
|
OPTION('x', mutex, true, false) \
|
|
|
|
OPTION('e', extents, true, false)
|
2017-05-28 06:35:36 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
#define OPTION(o, v, d, s) stats_print_option_num_##v,
|
|
|
|
STATS_PRINT_OPTIONS
|
|
|
|
#undef OPTION
|
|
|
|
stats_print_tot_num_options
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Options for stats_print. */
|
2017-04-21 04:38:12 +08:00
|
|
|
extern bool opt_stats_print;
|
2017-05-28 06:35:36 +08:00
|
|
|
extern char opt_stats_print_opts[stats_print_tot_num_options+1];
|
2017-04-21 04:38:12 +08:00
|
|
|
|
2020-01-14 14:29:17 +08:00
|
|
|
/* Utilities for stats_interval. */
|
|
|
|
extern int64_t opt_stats_interval;
|
|
|
|
extern char opt_stats_interval_opts[stats_print_tot_num_options+1];
|
|
|
|
|
|
|
|
#define STATS_INTERVAL_DEFAULT -1
|
|
|
|
/*
|
|
|
|
* Batch-increment the counter to reduce synchronization overhead. Each thread
|
|
|
|
* merges after (interval >> LG_BATCH_SIZE) bytes of allocations; also limit the
|
|
|
|
* BATCH_MAX for accuracy when the interval is huge (which is expected).
|
|
|
|
*/
|
|
|
|
#define STATS_INTERVAL_ACCUM_LG_BATCH_SIZE 6
|
|
|
|
#define STATS_INTERVAL_ACCUM_BATCH_MAX (4 << 20)
|
|
|
|
|
2020-04-16 01:49:08 +08:00
|
|
|
/* Only accessed by thread event. */
|
|
|
|
uint64_t stats_interval_new_event_wait(tsd_t *tsd);
|
2020-01-14 14:29:17 +08:00
|
|
|
bool stats_interval_accum(tsd_t *tsd, uint64_t bytes);
|
|
|
|
|
2017-04-21 04:38:12 +08:00
|
|
|
/* Implements je_malloc_stats_print. */
|
2020-04-18 05:49:20 +08:00
|
|
|
void stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts);
|
2017-04-21 04:38:12 +08:00
|
|
|
|
2020-01-14 14:29:17 +08:00
|
|
|
bool stats_boot(void);
|
2020-04-16 06:09:32 +08:00
|
|
|
void stats_prefork(tsdn_t *tsdn);
|
|
|
|
void stats_postfork_parent(tsdn_t *tsdn);
|
|
|
|
void stats_postfork_child(tsdn_t *tsdn);
|
2020-01-14 14:29:17 +08:00
|
|
|
|
2017-04-21 04:38:12 +08:00
|
|
|
#endif /* JEMALLOC_INTERNAL_STATS_H */
|