1 1.1 christos #ifndef JEMALLOC_INTERNAL_PROF_EXTERNS_H 2 1.1 christos #define JEMALLOC_INTERNAL_PROF_EXTERNS_H 3 1.1 christos 4 1.1 christos #include "jemalloc/internal/mutex.h" 5 1.1.1.2 christos #include "jemalloc/internal/prof_hook.h" 6 1.1 christos 7 1.1.1.2 christos extern bool opt_prof; 8 1.1.1.2 christos extern bool opt_prof_active; 9 1.1.1.2 christos extern bool opt_prof_thread_active_init; 10 1.1.1.2 christos extern size_t opt_lg_prof_sample; /* Mean bytes between samples. */ 11 1.1.1.2 christos extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */ 12 1.1.1.2 christos extern bool opt_prof_gdump; /* High-water memory dumping. */ 13 1.1.1.2 christos extern bool opt_prof_final; /* Final profile dumping. */ 14 1.1.1.2 christos extern bool opt_prof_leak; /* Dump leak summary at exit. */ 15 1.1.1.2 christos extern bool opt_prof_leak_error; /* Exit with error code if memory leaked */ 16 1.1.1.2 christos extern bool opt_prof_accum; /* Report cumulative bytes. */ 17 1.1.1.2 christos extern bool opt_prof_log; /* Turn logging on at boot. */ 18 1.1.1.2 christos extern char opt_prof_prefix[ 19 1.1 christos /* Minimize memory bloat for non-prof builds. */ 20 1.1 christos #ifdef JEMALLOC_PROF 21 1.1 christos PATH_MAX + 22 1.1 christos #endif 23 1.1 christos 1]; 24 1.1.1.2 christos extern bool opt_prof_unbias; 25 1.1.1.2 christos 26 1.1.1.2 christos /* For recording recent allocations */ 27 1.1.1.2 christos extern ssize_t opt_prof_recent_alloc_max; 28 1.1.1.2 christos 29 1.1.1.2 christos /* Whether to use thread name provided by the system or by mallctl. */ 30 1.1.1.2 christos extern bool opt_prof_sys_thread_name; 31 1.1.1.2 christos 32 1.1.1.2 christos /* Whether to record per size class counts and request size totals. */ 33 1.1.1.2 christos extern bool opt_prof_stats; 34 1.1 christos 35 1.1 christos /* Accessed via prof_active_[gs]et{_unlocked,}(). */ 36 1.1.1.2 christos extern bool prof_active_state; 37 1.1 christos 38 1.1 christos /* Accessed via prof_gdump_[gs]et{_unlocked,}(). */ 39 1.1.1.2 christos extern bool prof_gdump_val; 40 1.1 christos 41 1.1.1.2 christos /* Profile dump interval, measured in bytes allocated. */ 42 1.1.1.2 christos extern uint64_t prof_interval; 43 1.1 christos 44 1.1 christos /* 45 1.1 christos * Initialized as opt_lg_prof_sample, and potentially modified during profiling 46 1.1 christos * resets. 47 1.1 christos */ 48 1.1.1.2 christos extern size_t lg_prof_sample; 49 1.1 christos 50 1.1.1.2 christos extern bool prof_booted; 51 1.1 christos 52 1.1.1.2 christos void prof_backtrace_hook_set(prof_backtrace_hook_t hook); 53 1.1.1.2 christos prof_backtrace_hook_t prof_backtrace_hook_get(void); 54 1.1.1.2 christos 55 1.1.1.2 christos void prof_dump_hook_set(prof_dump_hook_t hook); 56 1.1.1.2 christos prof_dump_hook_t prof_dump_hook_get(void); 57 1.1.1.2 christos 58 1.1.1.2 christos /* Functions only accessed in prof_inlines.h */ 59 1.1.1.2 christos prof_tdata_t *prof_tdata_init(tsd_t *tsd); 60 1.1.1.2 christos prof_tdata_t *prof_tdata_reinit(tsd_t *tsd, prof_tdata_t *tdata); 61 1.1.1.2 christos 62 1.1.1.2 christos void prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx); 63 1.1.1.2 christos void prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t size, 64 1.1.1.2 christos size_t usize, prof_tctx_t *tctx); 65 1.1.1.2 christos void prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_info_t *prof_info); 66 1.1.1.2 christos prof_tctx_t *prof_tctx_create(tsd_t *tsd); 67 1.1 christos void prof_idump(tsdn_t *tsdn); 68 1.1 christos bool prof_mdump(tsd_t *tsd, const char *filename); 69 1.1 christos void prof_gdump(tsdn_t *tsdn); 70 1.1.1.2 christos 71 1.1 christos void prof_tdata_cleanup(tsd_t *tsd); 72 1.1 christos bool prof_active_get(tsdn_t *tsdn); 73 1.1 christos bool prof_active_set(tsdn_t *tsdn, bool active); 74 1.1 christos const char *prof_thread_name_get(tsd_t *tsd); 75 1.1 christos int prof_thread_name_set(tsd_t *tsd, const char *thread_name); 76 1.1 christos bool prof_thread_active_get(tsd_t *tsd); 77 1.1 christos bool prof_thread_active_set(tsd_t *tsd, bool active); 78 1.1 christos bool prof_thread_active_init_get(tsdn_t *tsdn); 79 1.1 christos bool prof_thread_active_init_set(tsdn_t *tsdn, bool active_init); 80 1.1 christos bool prof_gdump_get(tsdn_t *tsdn); 81 1.1 christos bool prof_gdump_set(tsdn_t *tsdn, bool active); 82 1.1 christos void prof_boot0(void); 83 1.1 christos void prof_boot1(void); 84 1.1.1.2 christos bool prof_boot2(tsd_t *tsd, base_t *base); 85 1.1 christos void prof_prefork0(tsdn_t *tsdn); 86 1.1 christos void prof_prefork1(tsdn_t *tsdn); 87 1.1 christos void prof_postfork_parent(tsdn_t *tsdn); 88 1.1 christos void prof_postfork_child(tsdn_t *tsdn); 89 1.1.1.2 christos 90 1.1.1.2 christos /* Only accessed by thread event. */ 91 1.1.1.2 christos uint64_t prof_sample_new_event_wait(tsd_t *tsd); 92 1.1.1.2 christos uint64_t prof_sample_postponed_event_wait(tsd_t *tsd); 93 1.1.1.2 christos void prof_sample_event_handler(tsd_t *tsd, uint64_t elapsed); 94 1.1 christos 95 1.1 christos #endif /* JEMALLOC_INTERNAL_PROF_EXTERNS_H */ 96