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