Header refactoring: stats - unify and remove from catchall

This commit is contained in:
David Goldblatt 2017-04-20 13:38:12 -07:00 committed by David Goldblatt
parent 36abf78aa9
commit d6b5c7e0f6
8 changed files with 29 additions and 35 deletions

View File

@ -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

View File

@ -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"
/*

View File

@ -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;

View File

@ -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"

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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"
/*