]> git.saurik.com Git - redis.git/blob - deps/jemalloc.orig/include/jemalloc/internal/ctl.h
Jemalloc updated to 3.0.0.
[redis.git] / deps / jemalloc.orig / include / jemalloc / internal / ctl.h
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3
4 typedef struct ctl_node_s ctl_node_t;
5 typedef struct ctl_arena_stats_s ctl_arena_stats_t;
6 typedef struct ctl_stats_s ctl_stats_t;
7
8 #endif /* JEMALLOC_H_TYPES */
9 /******************************************************************************/
10 #ifdef JEMALLOC_H_STRUCTS
11
12 struct ctl_node_s {
13 bool named;
14 union {
15 struct {
16 const char *name;
17 /* If (nchildren == 0), this is a terminal node. */
18 unsigned nchildren;
19 const ctl_node_t *children;
20 } named;
21 struct {
22 const ctl_node_t *(*index)(const size_t *, size_t,
23 size_t);
24 } indexed;
25 } u;
26 int (*ctl)(const size_t *, size_t, void *, size_t *, void *,
27 size_t);
28 };
29
30 struct ctl_arena_stats_s {
31 bool initialized;
32 unsigned nthreads;
33 size_t pactive;
34 size_t pdirty;
35 #ifdef JEMALLOC_STATS
36 arena_stats_t astats;
37
38 /* Aggregate stats for small size classes, based on bin stats. */
39 size_t allocated_small;
40 uint64_t nmalloc_small;
41 uint64_t ndalloc_small;
42 uint64_t nrequests_small;
43
44 malloc_bin_stats_t *bstats; /* nbins elements. */
45 malloc_large_stats_t *lstats; /* nlclasses elements. */
46 #endif
47 };
48
49 struct ctl_stats_s {
50 #ifdef JEMALLOC_STATS
51 size_t allocated;
52 size_t active;
53 size_t mapped;
54 struct {
55 size_t current; /* stats_chunks.curchunks */
56 uint64_t total; /* stats_chunks.nchunks */
57 size_t high; /* stats_chunks.highchunks */
58 } chunks;
59 struct {
60 size_t allocated; /* huge_allocated */
61 uint64_t nmalloc; /* huge_nmalloc */
62 uint64_t ndalloc; /* huge_ndalloc */
63 } huge;
64 #endif
65 ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */
66 #ifdef JEMALLOC_SWAP
67 size_t swap_avail;
68 #endif
69 };
70
71 #endif /* JEMALLOC_H_STRUCTS */
72 /******************************************************************************/
73 #ifdef JEMALLOC_H_EXTERNS
74
75 int ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp,
76 size_t newlen);
77 int ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp);
78
79 int ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
80 void *newp, size_t newlen);
81 bool ctl_boot(void);
82
83 #define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
84 if (JEMALLOC_P(mallctl)(name, oldp, oldlenp, newp, newlen) \
85 != 0) { \
86 malloc_write("<jemalloc>: Failure in xmallctl(\""); \
87 malloc_write(name); \
88 malloc_write("\", ...)\n"); \
89 abort(); \
90 } \
91 } while (0)
92
93 #define xmallctlnametomib(name, mibp, miblenp) do { \
94 if (JEMALLOC_P(mallctlnametomib)(name, mibp, miblenp) != 0) { \
95 malloc_write( \
96 "<jemalloc>: Failure in xmallctlnametomib(\""); \
97 malloc_write(name); \
98 malloc_write("\", ...)\n"); \
99 abort(); \
100 } \
101 } while (0)
102
103 #define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
104 if (JEMALLOC_P(mallctlbymib)(mib, miblen, oldp, oldlenp, newp, \
105 newlen) != 0) { \
106 malloc_write( \
107 "<jemalloc>: Failure in xmallctlbymib()\n"); \
108 abort(); \
109 } \
110 } while (0)
111
112 #endif /* JEMALLOC_H_EXTERNS */
113 /******************************************************************************/
114 #ifdef JEMALLOC_H_INLINES
115
116 #endif /* JEMALLOC_H_INLINES */
117 /******************************************************************************/
118