1 | #define JEMALLOC_CTL_C_ |
---|---|
2 | #include "jemalloc/internal/jemalloc_preamble.h" |
3 | #include "jemalloc/internal/jemalloc_internal_includes.h" |
4 | |
5 | #include "jemalloc/internal/assert.h" |
6 | #include "jemalloc/internal/ctl.h" |
7 | #include "jemalloc/internal/extent_dss.h" |
8 | #include "jemalloc/internal/extent_mmap.h" |
9 | #include "jemalloc/internal/mutex.h" |
10 | #include "jemalloc/internal/nstime.h" |
11 | #include "jemalloc/internal/sc.h" |
12 | #include "jemalloc/internal/util.h" |
13 | |
14 | /******************************************************************************/ |
15 | /* Data. */ |
16 | |
17 | /* |
18 | * ctl_mtx protects the following: |
19 | * - ctl_stats->* |
20 | */ |
21 | static malloc_mutex_t ctl_mtx; |
22 | static bool ctl_initialized; |
23 | static ctl_stats_t *ctl_stats; |
24 | static ctl_arenas_t *ctl_arenas; |
25 | |
26 | /******************************************************************************/ |
27 | /* Helpers for named and indexed nodes. */ |
28 | |
29 | static const ctl_named_node_t * |
30 | ctl_named_node(const ctl_node_t *node) { |
31 | return ((node->named) ? (const ctl_named_node_t *)node : NULL); |
32 | } |
33 | |
34 | static const ctl_named_node_t * |
35 | ctl_named_children(const ctl_named_node_t *node, size_t index) { |
36 | const ctl_named_node_t *children = ctl_named_node(node->children); |
37 | |
38 | return (children ? &children[index] : NULL); |
39 | } |
40 | |
41 | static const ctl_indexed_node_t * |
42 | ctl_indexed_node(const ctl_node_t *node) { |
43 | return (!node->named ? (const ctl_indexed_node_t *)node : NULL); |
44 | } |
45 | |
46 | /******************************************************************************/ |
47 | /* Function prototypes for non-inline static functions. */ |
48 | |
49 | #define CTL_PROTO(n) \ |
50 | static int n##_ctl(tsd_t * |