xref: /freebsd/contrib/jemalloc/include/jemalloc/internal/prof_types.h (revision c43cad87172039ccf38172129c79755ea79e6102)
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_cnt_s prof_cnt_t;
6 typedef struct prof_tctx_s prof_tctx_t;
7 typedef struct prof_info_s prof_info_t;
8 typedef struct prof_gctx_s prof_gctx_t;
9 typedef struct prof_tdata_s prof_tdata_t;
10 typedef struct prof_recent_s prof_recent_t;
11 
12 /* Option defaults. */
13 #ifdef JEMALLOC_PROF
14 #  define PROF_PREFIX_DEFAULT		"jeprof"
15 #else
16 #  define PROF_PREFIX_DEFAULT		""
17 #endif
18 #define LG_PROF_SAMPLE_DEFAULT		19
19 #define LG_PROF_INTERVAL_DEFAULT	-1
20 
21 /*
22  * Hard limit on stack backtrace depth.  The version of prof_backtrace() that
23  * is based on __builtin_return_address() necessarily has a hard-coded number
24  * of backtrace frame handlers, and should be kept in sync with this setting.
25  */
26 #define PROF_BT_MAX			128
27 
28 /* Initial hash table size. */
29 #define PROF_CKH_MINITEMS		64
30 
31 /* Size of memory buffer to use when writing dump files. */
32 #ifndef JEMALLOC_PROF
33 /* Minimize memory bloat for non-prof builds. */
34 #  define PROF_DUMP_BUFSIZE		1
35 #elif defined(JEMALLOC_DEBUG)
36 /* Use a small buffer size in debug build, mainly to facilitate testing. */
37 #  define PROF_DUMP_BUFSIZE		16
38 #else
39 #  define PROF_DUMP_BUFSIZE		65536
40 #endif
41 
42 /* Size of size class related tables */
43 #ifdef JEMALLOC_PROF
44 #  define PROF_SC_NSIZES		SC_NSIZES
45 #else
46 /* Minimize memory bloat for non-prof builds. */
47 #  define PROF_SC_NSIZES		1
48 #endif
49 
50 /* Size of stack-allocated buffer used by prof_printf(). */
51 #define PROF_PRINTF_BUFSIZE		128
52 
53 /*
54  * Number of mutexes shared among all gctx's.  No space is allocated for these
55  * unless profiling is enabled, so it's okay to over-provision.
56  */
57 #define PROF_NCTX_LOCKS			1024
58 
59 /*
60  * Number of mutexes shared among all tdata's.  No space is allocated for these
61  * unless profiling is enabled, so it's okay to over-provision.
62  */
63 #define PROF_NTDATA_LOCKS		256
64 
65 /* Minimize memory bloat for non-prof builds. */
66 #ifdef JEMALLOC_PROF
67 #define PROF_DUMP_FILENAME_LEN (PATH_MAX + 1)
68 #else
69 #define PROF_DUMP_FILENAME_LEN 1
70 #endif
71 
72 /* Default number of recent allocations to record. */
73 #define PROF_RECENT_ALLOC_MAX_DEFAULT 0
74 
75 #endif /* JEMALLOC_INTERNAL_PROF_TYPES_H */
76