PA: Add a stats type.

This commit is contained in:
David Goldblatt
2020-03-08 13:08:15 -07:00
committed by David Goldblatt
parent 688fb3eb89
commit 32cb7c2f0b
6 changed files with 35 additions and 11 deletions

View File

@@ -4,6 +4,7 @@
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/mutex.h"
#include "jemalloc/internal/mutex_prof.h"
#include "jemalloc/internal/pa.h"
#include "jemalloc/internal/sc.h"
JEMALLOC_DIAGNOSTIC_DISABLE_SPURIOUS
@@ -112,8 +113,12 @@ struct arena_stats_s {
arena_stats_u64_t nflushes_large; /* Derived. */
arena_stats_u64_t nrequests_large; /* Derived. */
/* VM space had to be leaked (undocumented). Normally 0. */
atomic_zu_t abandoned_vm;
/*
* The stats logically owned by the pa_shard in the same arena. This
* lives here only because it's convenient for the purposes of the ctl
* module -- it only knows about the single arena_stats.
*/
pa_shard_stats_t pa_shard_stats;
/* Number of bytes cached in tcache associated with this arena. */
atomic_zu_t tcache_bytes; /* Derived. */

View File

@@ -1,11 +1,20 @@
#ifndef JEMALLOC_INTERNAL_PA_H
#define JEMALLOC_INTERNAL_PA_H
#include "jemalloc/internal/ecache.h"
#include "jemalloc/internal/edata_cache.h"
/*
* The page allocator; responsible for acquiring pages of memory for
* allocations.
*/
typedef struct pa_shard_stats_s pa_shard_stats_t;
struct pa_shard_stats_s {
/* VM space had to be leaked (undocumented). Normally 0. */
atomic_zu_t abandoned_vm;
};
typedef struct pa_shard_s pa_shard_t;
struct pa_shard_s {
/*
@@ -20,9 +29,12 @@ struct pa_shard_s {
/* The source of edata_t objects. */
edata_cache_t edata_cache;
pa_shard_stats_t *stats;
};
/* Returns true on error. */
bool pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind);
bool pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind,
pa_shard_stats_t *stats);
#endif /* JEMALLOC_INTERNAL_PA_H */