summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-04-20 20:38:12 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-04-24 17:33:21 (GMT)
commitd6b5c7e0f6973fa95d398cb9df3f48ac205e1fc3 (patch)
treefcd26a12228dcdbe2f042f6ccdcea006000058f8 /include/jemalloc
parent36abf78aa924f5f038f94443357e89ae86ae3510 (diff)
downloadjemalloc-d6b5c7e0f6973fa95d398cb9df3f48ac205e1fc3.zip
jemalloc-d6b5c7e0f6973fa95d398cb9df3f48ac205e1fc3.tar.gz
jemalloc-d6b5c7e0f6973fa95d398cb9df3f48ac205e1fc3.tar.bz2
Header refactoring: stats - unify and remove from catchall
Diffstat (limited to 'include/jemalloc')
-rw-r--r--include/jemalloc/internal/arena_externs.h1
-rw-r--r--include/jemalloc/internal/arena_structs_b.h1
-rw-r--r--include/jemalloc/internal/ctl_structs.h1
-rw-r--r--include/jemalloc/internal/jemalloc_internal_includes.h3
-rw-r--r--include/jemalloc/internal/stats.h (renamed from include/jemalloc/internal/stats_structs.h)38
-rw-r--r--include/jemalloc/internal/stats_externs.h9
-rw-r--r--include/jemalloc/internal/stats_types.h10
-rw-r--r--include/jemalloc/internal/tcache_structs.h1
8 files changed, 29 insertions, 35 deletions
diff --git a/include/jemalloc/internal/arena_externs.h b/include/jemalloc/internal/arena_externs.h
index 241165e..1e13efd 100644
--- a/include/jemalloc/internal/arena_externs.h
+++ b/include/jemalloc/internal/arena_externs.h
@@ -2,6 +2,7 @@
#define JEMALLOC_INTERNAL_ARENA_EXTERNS_H
#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/stats.h"
static const size_t large_pad =
#ifdef JEMALLOC_CACHE_OBLIVIOUS
diff --git a/include/jemalloc/internal/arena_structs_b.h b/include/jemalloc/internal/arena_structs_b.h
index 8a7d7a1..bef73aa 100644
--- a/include/jemalloc/internal/arena_structs_b.h
+++ b/include/jemalloc/internal/arena_structs_b.h
@@ -7,6 +7,7 @@
#include "jemalloc/internal/ql.h"
#include "jemalloc/internal/size_classes.h"
#include "jemalloc/internal/smoothstep.h"
+#include "jemalloc/internal/stats.h"
#include "jemalloc/internal/ticker.h"
/*
diff --git a/include/jemalloc/internal/ctl_structs.h b/include/jemalloc/internal/ctl_structs.h
index b0c37c9..c64820d 100644
--- a/include/jemalloc/internal/ctl_structs.h
+++ b/include/jemalloc/internal/ctl_structs.h
@@ -4,6 +4,7 @@
#include "jemalloc/internal/jemalloc_internal_types.h"
#include "jemalloc/internal/ql.h"
#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/stats.h"
struct ctl_node_s {
bool named;
diff --git a/include/jemalloc/internal/jemalloc_internal_includes.h b/include/jemalloc/internal/jemalloc_internal_includes.h
index 8b650fb..0cb6183 100644
--- a/include/jemalloc/internal/jemalloc_internal_includes.h
+++ b/include/jemalloc/internal/jemalloc_internal_includes.h
@@ -40,7 +40,6 @@
/* TYPES */
/******************************************************************************/
-#include "jemalloc/internal/stats_types.h"
#include "jemalloc/internal/ctl_types.h"
#include "jemalloc/internal/witness_types.h"
#include "jemalloc/internal/mutex_types.h"
@@ -61,7 +60,6 @@
#include "jemalloc/internal/witness_structs.h"
#include "jemalloc/internal/mutex_structs.h"
-#include "jemalloc/internal/stats_structs.h"
#include "jemalloc/internal/ctl_structs.h"
#include "jemalloc/internal/bitmap_structs.h"
#include "jemalloc/internal/arena_structs_a.h"
@@ -79,7 +77,6 @@
/******************************************************************************/
#include "jemalloc/internal/jemalloc_internal_externs.h"
-#include "jemalloc/internal/stats_externs.h"
#include "jemalloc/internal/ctl_externs.h"
#include "jemalloc/internal/witness_externs.h"
#include "jemalloc/internal/mutex_externs.h"
diff --git a/include/jemalloc/internal/stats_structs.h b/include/jemalloc/internal/stats.h
index 3693a85..9414200 100644
--- a/include/jemalloc/internal/stats_structs.h
+++ b/include/jemalloc/internal/stats.h
@@ -1,9 +1,21 @@
-#ifndef JEMALLOC_INTERNAL_STATS_STRUCTS_H
-#define JEMALLOC_INTERNAL_STATS_STRUCTS_H
+#ifndef JEMALLOC_INTERNAL_STATS_H
+#define JEMALLOC_INTERNAL_STATS_H
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/size_classes.h"
+/* The opt.stats_print storage. */
+extern bool opt_stats_print;
+
+/* Implements je_malloc_stats_print. */
+void stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
+ const char *opts);
+
+/*
+ * In those architectures that support 64-bit atomics, we use atomic updates for
+ * our 64-bit values. Otherwise, we use a plain uint64_t and synchronize
+ * externally.
+ */
#ifdef JEMALLOC_ATOMIC_U64
typedef atomic_u64_t arena_stats_u64_t;
#else
@@ -11,15 +23,15 @@ typedef atomic_u64_t arena_stats_u64_t;
typedef uint64_t arena_stats_u64_t;
#endif
-struct tcache_bin_stats_s {
+typedef struct tcache_bin_stats_s {
/*
* Number of allocation requests that corresponded to the size of this
* bin.
*/
uint64_t nrequests;
-};
+} tcache_bin_stats_t;
-struct malloc_bin_stats_s {
+typedef struct malloc_bin_stats_s {
/*
* Total number of allocation/deallocation requests served directly by
* the bin. Note that tcache may allocate an object, then recycle it
@@ -61,9 +73,9 @@ struct malloc_bin_stats_s {
size_t curslabs;
mutex_prof_data_t mutex_data;
-};
+} malloc_bin_stats_t;
-struct malloc_large_stats_s {
+typedef struct malloc_large_stats_s {
/*
* Total number of allocation/deallocation requests served directly by
* the arena.
@@ -80,23 +92,23 @@ struct malloc_large_stats_s {
/* Current number of allocations of this size class. */
size_t curlextents; /* Derived. */
-};
+} malloc_large_stats_t;
-struct decay_stats_s {
+typedef struct decay_stats_s {
/* Total number of purge sweeps. */
arena_stats_u64_t npurge;
/* Total number of madvise calls made. */
arena_stats_u64_t nmadvise;
/* Total number of pages purged. */
arena_stats_u64_t purged;
-};
+} decay_stats_t;
/*
* Arena stats. Note that fields marked "derived" are not directly maintained
* within the arena code; rather their values are derived during stats merge
* requests.
*/
-struct arena_stats_s {
+typedef struct arena_stats_s {
#ifndef JEMALLOC_ATOMIC_U64
malloc_mutex_t mtx;
#endif
@@ -131,6 +143,6 @@ struct arena_stats_s {
/* One element for each large size class. */
malloc_large_stats_t lstats[NSIZES - NBINS];
-};
+} arena_stats_t;
-#endif /* JEMALLOC_INTERNAL_STATS_STRUCTS_H */
+#endif /* JEMALLOC_INTERNAL_STATS_H */
diff --git a/include/jemalloc/internal/stats_externs.h b/include/jemalloc/internal/stats_externs.h
deleted file mode 100644
index 519441c..0000000
--- a/include/jemalloc/internal/stats_externs.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_STATS_EXTERNS_H
-#define JEMALLOC_INTERNAL_STATS_EXTERNS_H
-
-extern bool opt_stats_print;
-
-void stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *opts);
-
-#endif /* JEMALLOC_INTERNAL_STATS_EXTERNS_H */
diff --git a/include/jemalloc/internal/stats_types.h b/include/jemalloc/internal/stats_types.h
deleted file mode 100644
index 4848338..0000000
--- a/include/jemalloc/internal/stats_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_STATS_TYPES_H
-#define JEMALLOC_INTERNAL_STATS_TYPES_H
-
-typedef struct tcache_bin_stats_s tcache_bin_stats_t;
-typedef struct malloc_bin_stats_s malloc_bin_stats_t;
-typedef struct malloc_large_stats_s malloc_large_stats_t;
-typedef struct decay_stats_s decay_stats_t;
-typedef struct arena_stats_s arena_stats_t;
-
-#endif /* JEMALLOC_INTERNAL_STATS_TYPES_H */
diff --git a/include/jemalloc/internal/tcache_structs.h b/include/jemalloc/internal/tcache_structs.h
index cd0cea5..7c0afb0 100644
--- a/include/jemalloc/internal/tcache_structs.h
+++ b/include/jemalloc/internal/tcache_structs.h
@@ -3,6 +3,7 @@
#include "jemalloc/internal/ql.h"
#include "jemalloc/internal/size_classes.h"
+#include "jemalloc/internal/stats.h"
#include "jemalloc/internal/ticker.h"
/*