1 #ifndef JEMALLOC_INTERNAL_CTL_STRUCTS_H
2 #define JEMALLOC_INTERNAL_CTL_STRUCTS_H
3 
4 struct ctl_node_s {
5 	bool			named;
6 };
7 
8 struct ctl_named_node_s {
9 	struct ctl_node_s	node;
10 	const char		*name;
11 	/* If (nchildren == 0), this is a terminal node. */
12 	size_t			nchildren;
13 	const			ctl_node_t *children;
14 	int			(*ctl)(tsd_t *, const size_t *, size_t, void *,
15 	    size_t *, void *, size_t);
16 };
17 
18 struct ctl_indexed_node_s {
19 	struct ctl_node_s	node;
20 	const ctl_named_node_t	*(*index)(tsdn_t *, const size_t *, size_t,
21 	    size_t);
22 };
23 
24 struct ctl_arena_stats_s {
25 	arena_stats_t		astats;
26 
27 	/* Aggregate stats for small size classes, based on bin stats. */
28 	size_t			allocated_small;
29 	uint64_t		nmalloc_small;
30 	uint64_t		ndalloc_small;
31 	uint64_t		nrequests_small;
32 
33 	malloc_bin_stats_t	bstats[NBINS];
34 	malloc_large_stats_t	lstats[NSIZES - NBINS];
35 };
36 
37 struct ctl_stats_s {
38 	size_t			allocated;
39 	size_t			active;
40 	size_t			metadata;
41 	size_t			resident;
42 	size_t			mapped;
43 	size_t			retained;
44 };
45 
46 struct ctl_arena_s {
47 	unsigned		arena_ind;
48 	bool			initialized;
49 	ql_elm(ctl_arena_t)	destroyed_link;
50 
51 	/* Basic stats, supported even if !config_stats. */
52 	unsigned		nthreads;
53 	const char		*dss;
54 	ssize_t			decay_time;
55 	size_t			pactive;
56 	size_t			pdirty;
57 
58 	/* NULL if !config_stats. */
59 	ctl_arena_stats_t	*astats;
60 };
61 
62 struct ctl_arenas_s {
63 	uint64_t		epoch;
64 	unsigned		narenas;
65 	ql_head(ctl_arena_t)	destroyed;
66 
67 	/*
68 	 * Element 0 corresponds to merged stats for extant arenas (accessed via
69 	 * MALLCTL_ARENAS_ALL), element 1 corresponds to merged stats for
70 	 * destroyed arenas (accessed via MALLCTL_ARENAS_DESTROYED), and the
71 	 * remaining MALLOCX_ARENA_MAX+1 elements correspond to arenas.
72 	 */
73 	ctl_arena_t		*arenas[MALLOCX_ARENA_MAX + 3];
74 };
75 
76 #endif /* JEMALLOC_INTERNAL_CTL_STRUCTS_H */
77