1 #ifndef JEMALLOC_INTERNAL_PROF_EXTERNS_H
2 #define JEMALLOC_INTERNAL_PROF_EXTERNS_H
3 
4 #pragma GCC visibility push(hidden)
5 
6 extern bool	opt_prof;
7 extern bool	opt_prof_active;
8 extern bool	opt_prof_thread_active_init;
9 extern size_t	opt_lg_prof_sample;   /* Mean bytes between samples. */
10 extern ssize_t	opt_lg_prof_interval; /* lg(prof_interval). */
11 extern bool	opt_prof_gdump;       /* High-water memory dumping. */
12 extern bool	opt_prof_final;       /* Final profile dumping. */
13 extern bool	opt_prof_leak;        /* Dump leak summary at exit. */
14 extern bool	opt_prof_accum;       /* Report cumulative bytes. */
15 extern char	opt_prof_prefix[
16     /* Minimize memory bloat for non-prof builds. */
17 #ifdef JEMALLOC_PROF
18     PATH_MAX +
19 #endif
20     1];
21 
22 /* Accessed via prof_active_[gs]et{_unlocked,}(). */
23 extern bool	prof_active;
24 
25 /* Accessed via prof_gdump_[gs]et{_unlocked,}(). */
26 extern bool	prof_gdump_val;
27 
28 /*
29  * Profile dump interval, measured in bytes allocated.  Each arena triggers a
30  * profile dump when it reaches this threshold.  The effect is that the
31  * interval between profile dumps averages prof_interval, though the actual
32  * interval between dumps will tend to be sporadic, and the interval will be a
33  * maximum of approximately (prof_interval * narenas).
34  */
35 extern uint64_t	prof_interval;
36 
37 /*
38  * Initialized as opt_lg_prof_sample, and potentially modified during profiling
39  * resets.
40  */
41 extern size_t	lg_prof_sample;
42 
43 void	prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated);
44 void	prof_malloc_sample_object(tsdn_t *tsdn, extent_t *extent,
45     const void *ptr, size_t usize, prof_tctx_t *tctx);
46 void	prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx);
47 void	bt_init(prof_bt_t *bt, void **vec);
48 void	prof_backtrace(prof_bt_t *bt);
49 prof_tctx_t	*prof_lookup(tsd_t *tsd, prof_bt_t *bt);
50 #ifdef JEMALLOC_JET
51 size_t	prof_tdata_count(void);
52 size_t	prof_bt_count(void);
53 typedef int (prof_dump_open_t)(bool, const char *);
54 extern prof_dump_open_t *prof_dump_open;
55 typedef bool (prof_dump_header_t)(tsdn_t *, bool, const prof_cnt_t *);
56 extern prof_dump_header_t *prof_dump_header;
57 void	prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes,
58     uint64_t *accumobjs, uint64_t *accumbytes);
59 #endif
60 void	prof_idump(tsdn_t *tsdn);
61 bool	prof_mdump(tsd_t *tsd, const char *filename);
62 void	prof_gdump(tsdn_t *tsdn);
63 prof_tdata_t	*prof_tdata_init(tsd_t *tsd);
64 prof_tdata_t	*prof_tdata_reinit(tsd_t *tsd, prof_tdata_t *tdata);
65 void	prof_reset(tsd_t *tsd, size_t lg_sample);
66 void	prof_tdata_cleanup(tsd_t *tsd);
67 bool	prof_active_get(tsdn_t *tsdn);
68 bool	prof_active_set(tsdn_t *tsdn, bool active);
69 const char	*prof_thread_name_get(tsd_t *tsd);
70 int	prof_thread_name_set(tsd_t *tsd, const char *thread_name);
71 bool	prof_thread_active_get(tsd_t *tsd);
72 bool	prof_thread_active_set(tsd_t *tsd, bool active);
73 bool	prof_thread_active_init_get(tsdn_t *tsdn);
74 bool	prof_thread_active_init_set(tsdn_t *tsdn, bool active_init);
75 bool	prof_gdump_get(tsdn_t *tsdn);
76 bool	prof_gdump_set(tsdn_t *tsdn, bool active);
77 void	prof_boot0(void);
78 void	prof_boot1(void);
79 bool	prof_boot2(tsd_t *tsd);
80 void	prof_prefork0(tsdn_t *tsdn);
81 void	prof_prefork1(tsdn_t *tsdn);
82 void	prof_postfork_parent(tsdn_t *tsdn);
83 void	prof_postfork_child(tsdn_t *tsdn);
84 void	prof_sample_threshold_update(prof_tdata_t *tdata);
85 
86 #pragma GCC visibility pop
87 
88 #endif /* JEMALLOC_INTERNAL_PROF_EXTERNS_H */
89