xref: /freebsd/contrib/jemalloc/include/jemalloc/internal/prof_types.h (revision 4198293b2568c3fa287e7bde71162e9d442f4305)
1 #ifndef JEMALLOC_INTERNAL_PROF_TYPES_H
2 #define JEMALLOC_INTERNAL_PROF_TYPES_H
3 
4 typedef struct prof_bt_s prof_bt_t;
5 typedef struct prof_accum_s prof_accum_t;
6 typedef struct prof_cnt_s prof_cnt_t;
7 typedef struct prof_tctx_s prof_tctx_t;
8 typedef struct prof_gctx_s prof_gctx_t;
9 typedef struct prof_tdata_s prof_tdata_t;
10 
11 /* Option defaults. */
12 #ifdef JEMALLOC_PROF
13 #  define PROF_PREFIX_DEFAULT		"jeprof"
14 #else
15 #  define PROF_PREFIX_DEFAULT		""
16 #endif
17 #define LG_PROF_SAMPLE_DEFAULT		19
18 #define LG_PROF_INTERVAL_DEFAULT	-1
19 
20 /*
21  * Hard limit on stack backtrace depth.  The version of prof_backtrace() that
22  * is based on __builtin_return_address() necessarily has a hard-coded number
23  * of backtrace frame handlers, and should be kept in sync with this setting.
24  */
25 #define PROF_BT_MAX			128
26 
27 /* Initial hash table size. */
28 #define PROF_CKH_MINITEMS		64
29 
30 /* Size of memory buffer to use when writing dump files. */
31 #define PROF_DUMP_BUFSIZE		65536
32 
33 /* Size of stack-allocated buffer used by prof_printf(). */
34 #define PROF_PRINTF_BUFSIZE		128
35 
36 /*
37  * Number of mutexes shared among all gctx's.  No space is allocated for these
38  * unless profiling is enabled, so it's okay to over-provision.
39  */
40 #define PROF_NCTX_LOCKS			1024
41 
42 /*
43  * Number of mutexes shared among all tdata's.  No space is allocated for these
44  * unless profiling is enabled, so it's okay to over-provision.
45  */
46 #define PROF_NTDATA_LOCKS		256
47 
48 /*
49  * prof_tdata pointers close to NULL are used to encode state information that
50  * is used for cleaning up during thread shutdown.
51  */
52 #define PROF_TDATA_STATE_REINCARNATED	((prof_tdata_t *)(uintptr_t)1)
53 #define PROF_TDATA_STATE_PURGATORY	((prof_tdata_t *)(uintptr_t)2)
54 #define PROF_TDATA_STATE_MAX		PROF_TDATA_STATE_PURGATORY
55 
56 #endif /* JEMALLOC_INTERNAL_PROF_TYPES_H */
57