TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ctl.h
Go to the documentation of this file.
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3 
4 typedef struct ctl_node_s ctl_node_t;
5 typedef struct ctl_named_node_s ctl_named_node_t;
6 typedef struct ctl_indexed_node_s ctl_indexed_node_t;
7 typedef struct ctl_arena_stats_s ctl_arena_stats_t;
8 typedef struct ctl_stats_s ctl_stats_t;
9 
10 #endif /* JEMALLOC_H_TYPES */
11 /******************************************************************************/
12 #ifdef JEMALLOC_H_STRUCTS
13 
14 struct ctl_node_s {
15  bool named;
16 };
17 
18 struct ctl_named_node_s {
19  struct ctl_node_s node;
20  const char *name;
21  /* If (nchildren == 0), this is a terminal node. */
22  unsigned nchildren;
23  const ctl_node_t *children;
24  int (*ctl)(const size_t *, size_t, void *, size_t *,
25  void *, size_t);
26 };
27 
28 struct ctl_indexed_node_s {
29  struct ctl_node_s node;
30  const ctl_named_node_t *(*index)(const size_t *, size_t, size_t);
31 };
32 
33 struct ctl_arena_stats_s {
34  bool initialized;
35  unsigned nthreads;
36  const char *dss;
37  size_t pactive;
38  size_t pdirty;
39  arena_stats_t astats;
40 
41  /* Aggregate stats for small size classes, based on bin stats. */
42  size_t allocated_small;
43  uint64_t nmalloc_small;
44  uint64_t ndalloc_small;
45  uint64_t nrequests_small;
46 
47  malloc_bin_stats_t bstats[NBINS];
48  malloc_large_stats_t *lstats; /* nlclasses elements. */
49 };
50 
51 struct ctl_stats_s {
52  size_t allocated;
53  size_t active;
54  size_t mapped;
55  struct {
56  size_t current; /* stats_chunks.curchunks */
57  uint64_t total; /* stats_chunks.nchunks */
58  size_t high; /* stats_chunks.highchunks */
59  } chunks;
60  struct {
61  size_t allocated; /* huge_allocated */
62  uint64_t nmalloc; /* huge_nmalloc */
63  uint64_t ndalloc; /* huge_ndalloc */
64  } huge;
65  unsigned narenas;
66  ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */
67 };
68 
69 #endif /* JEMALLOC_H_STRUCTS */
70 /******************************************************************************/
71 #ifdef JEMALLOC_H_EXTERNS
72 
73 int ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp,
74  size_t newlen);
75 int ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp);
76 
77 int ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
78  void *newp, size_t newlen);
79 bool ctl_boot(void);
80 void ctl_prefork(void);
81 void ctl_postfork_parent(void);
82 void ctl_postfork_child(void);
83 
84 #define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
85  if (je_mallctl(name, oldp, oldlenp, newp, newlen) \
86  != 0) { \
87  malloc_printf( \
88  "<jemalloc>: Failure in xmallctl(\"%s\", ...)\n", \
89  name); \
90  abort(); \
91  } \
92 } while (0)
93 
94 #define xmallctlnametomib(name, mibp, miblenp) do { \
95  if (je_mallctlnametomib(name, mibp, miblenp) != 0) { \
96  malloc_printf("<jemalloc>: Failure in " \
97  "xmallctlnametomib(\"%s\", ...)\n", name); \
98  abort(); \
99  } \
100 } while (0)
101 
102 #define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
103  if (je_mallctlbymib(mib, miblen, oldp, oldlenp, newp, \
104  newlen) != 0) { \
105  malloc_write( \
106  "<jemalloc>: Failure in xmallctlbymib()\n"); \
107  abort(); \
108  } \
109 } while (0)
110 
111 #endif /* JEMALLOC_H_EXTERNS */
112 /******************************************************************************/
113 #ifdef JEMALLOC_H_INLINES
114 
115 #endif /* JEMALLOC_H_INLINES */
116 /******************************************************************************/
117 
#define ctl_prefork
Definition: private_namespace.h:151
#define ctl_bymib
Definition: private_namespace.h:146
#define ctl_byname
Definition: private_namespace.h:147
unsigned __int64 uint64_t
Definition: stdint.h:90
#define ctl_nametomib
Definition: private_namespace.h:148
#define ctl_postfork_child
Definition: private_namespace.h:149
#define ctl_postfork_parent
Definition: private_namespace.h:150
#define ctl_boot
Definition: private_namespace.h:145
arena_t ** arenas
Definition: jemalloc_internal.h:624