Move extent stats to the PA module.
While we're at it, make them non-atomic -- they are purely derived statistics (and in fact aren't even in the arena_t or pa_shard_t).
This commit is contained in:
parent
527dd4cdb8
commit
f6bfa3dcca
@ -26,7 +26,7 @@ void arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
|
|||||||
const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms,
|
const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms,
|
||||||
size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats,
|
size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats,
|
||||||
bin_stats_data_t *bstats, arena_stats_large_t *lstats,
|
bin_stats_data_t *bstats, arena_stats_large_t *lstats,
|
||||||
arena_stats_extents_t *estats);
|
pa_extent_stats_t *estats);
|
||||||
void arena_handle_new_dirty_pages(tsdn_t *tsdn, arena_t *arena);
|
void arena_handle_new_dirty_pages(tsdn_t *tsdn, arena_t *arena);
|
||||||
#ifdef JEMALLOC_JET
|
#ifdef JEMALLOC_JET
|
||||||
size_t arena_slab_regind(edata_t *slab, szind_t binind, const void *ptr);
|
size_t arena_slab_regind(edata_t *slab, szind_t binind, const void *ptr);
|
||||||
|
@ -37,22 +37,6 @@ struct arena_stats_large_s {
|
|||||||
size_t curlextents; /* Derived. */
|
size_t curlextents; /* Derived. */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct arena_stats_extents_s arena_stats_extents_t;
|
|
||||||
struct arena_stats_extents_s {
|
|
||||||
/*
|
|
||||||
* Stats for a given index in the range [0, SC_NPSIZES] in an extents_t.
|
|
||||||
* We track both bytes and # of extents: two extents in the same bucket
|
|
||||||
* may have different sizes if adjacent size classes differ by more than
|
|
||||||
* a page, so bytes cannot always be derived from # of extents.
|
|
||||||
*/
|
|
||||||
atomic_zu_t ndirty;
|
|
||||||
atomic_zu_t dirty_bytes;
|
|
||||||
atomic_zu_t nmuzzy;
|
|
||||||
atomic_zu_t muzzy_bytes;
|
|
||||||
atomic_zu_t nretained;
|
|
||||||
atomic_zu_t retained_bytes;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arena stats. Note that fields marked "derived" are not directly maintained
|
* Arena stats. Note that fields marked "derived" are not directly maintained
|
||||||
* within the arena code; rather their values are derived during stats merge
|
* within the arena code; rather their values are derived during stats merge
|
||||||
|
@ -44,7 +44,7 @@ typedef struct ctl_arena_stats_s {
|
|||||||
|
|
||||||
bin_stats_data_t bstats[SC_NBINS];
|
bin_stats_data_t bstats[SC_NBINS];
|
||||||
arena_stats_large_t lstats[SC_NSIZES - SC_NBINS];
|
arena_stats_large_t lstats[SC_NSIZES - SC_NBINS];
|
||||||
arena_stats_extents_t estats[SC_NPSIZES];
|
pa_extent_stats_t estats[SC_NPSIZES];
|
||||||
} ctl_arena_stats_t;
|
} ctl_arena_stats_t;
|
||||||
|
|
||||||
typedef struct ctl_stats_s {
|
typedef struct ctl_stats_s {
|
||||||
|
@ -29,6 +29,23 @@ struct pa_shard_decay_stats_s {
|
|||||||
locked_u64_t purged;
|
locked_u64_t purged;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct pa_extent_stats_s pa_extent_stats_t;
|
||||||
|
struct pa_extent_stats_s {
|
||||||
|
/*
|
||||||
|
* Stats for a given index in the range [0, SC_NPSIZES] in the various
|
||||||
|
* ecache_ts.
|
||||||
|
* We track both bytes and # of extents: two extents in the same bucket
|
||||||
|
* may have different sizes if adjacent size classes differ by more than
|
||||||
|
* a page, so bytes cannot always be derived from # of extents.
|
||||||
|
*/
|
||||||
|
size_t ndirty;
|
||||||
|
size_t dirty_bytes;
|
||||||
|
size_t nmuzzy;
|
||||||
|
size_t muzzy_bytes;
|
||||||
|
size_t nretained;
|
||||||
|
size_t retained_bytes;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The stats for a particular pa_shard. Because of the way the ctl module
|
* The stats for a particular pa_shard. Because of the way the ctl module
|
||||||
* handles stats epoch data collection (it has its own arena_stats, and merges
|
* handles stats epoch data collection (it has its own arena_stats, and merges
|
||||||
|
17
src/arena.c
17
src/arena.c
@ -81,7 +81,7 @@ arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
|
|||||||
const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms,
|
const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms,
|
||||||
size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats,
|
size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats,
|
||||||
bin_stats_data_t *bstats, arena_stats_large_t *lstats,
|
bin_stats_data_t *bstats, arena_stats_large_t *lstats,
|
||||||
arena_stats_extents_t *estats) {
|
pa_extent_stats_t *estats) {
|
||||||
cassert(config_stats);
|
cassert(config_stats);
|
||||||
|
|
||||||
arena_basic_stats_merge(tsdn, arena, nthreads, dss, dirty_decay_ms,
|
arena_basic_stats_merge(tsdn, arena, nthreads, dss, dirty_decay_ms,
|
||||||
@ -200,15 +200,12 @@ arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
|
|||||||
retained_bytes = ecache_nbytes_get(
|
retained_bytes = ecache_nbytes_get(
|
||||||
&arena->pa_shard.ecache_retained, i);
|
&arena->pa_shard.ecache_retained, i);
|
||||||
|
|
||||||
atomic_store_zu(&estats[i].ndirty, dirty, ATOMIC_RELAXED);
|
estats[i].ndirty = dirty;
|
||||||
atomic_store_zu(&estats[i].nmuzzy, muzzy, ATOMIC_RELAXED);
|
estats[i].nmuzzy = muzzy;
|
||||||
atomic_store_zu(&estats[i].nretained, retained, ATOMIC_RELAXED);
|
estats[i].nretained = retained;
|
||||||
atomic_store_zu(&estats[i].dirty_bytes, dirty_bytes,
|
estats[i].dirty_bytes = dirty_bytes;
|
||||||
ATOMIC_RELAXED);
|
estats[i].muzzy_bytes = muzzy_bytes;
|
||||||
atomic_store_zu(&estats[i].muzzy_bytes, muzzy_bytes,
|
estats[i].retained_bytes = retained_bytes;
|
||||||
ATOMIC_RELAXED);
|
|
||||||
atomic_store_zu(&estats[i].retained_bytes, retained_bytes,
|
|
||||||
ATOMIC_RELAXED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCKEDINT_MTX_UNLOCK(tsdn, arena->stats.mtx);
|
LOCKEDINT_MTX_UNLOCK(tsdn, arena->stats.mtx);
|
||||||
|
48
src/ctl.c
48
src/ctl.c
@ -804,7 +804,7 @@ ctl_arena_clear(ctl_arena_t *ctl_arena) {
|
|||||||
memset(ctl_arena->astats->lstats, 0, (SC_NSIZES - SC_NBINS) *
|
memset(ctl_arena->astats->lstats, 0, (SC_NSIZES - SC_NBINS) *
|
||||||
sizeof(arena_stats_large_t));
|
sizeof(arena_stats_large_t));
|
||||||
memset(ctl_arena->astats->estats, 0, SC_NPSIZES *
|
memset(ctl_arena->astats->estats, 0, SC_NPSIZES *
|
||||||
sizeof(arena_stats_extents_t));
|
sizeof(pa_extent_stats_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -993,18 +993,16 @@ MUTEX_PROF_ARENA_MUTEXES
|
|||||||
|
|
||||||
/* Merge extents stats. */
|
/* Merge extents stats. */
|
||||||
for (i = 0; i < SC_NPSIZES; i++) {
|
for (i = 0; i < SC_NPSIZES; i++) {
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].ndirty,
|
sdstats->estats[i].ndirty += astats->estats[i].ndirty;
|
||||||
&astats->estats[i].ndirty);
|
sdstats->estats[i].nmuzzy += astats->estats[i].nmuzzy;
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].nmuzzy,
|
sdstats->estats[i].nretained
|
||||||
&astats->estats[i].nmuzzy);
|
+= astats->estats[i].nretained;
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].nretained,
|
sdstats->estats[i].dirty_bytes
|
||||||
&astats->estats[i].nretained);
|
+= astats->estats[i].dirty_bytes;
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].dirty_bytes,
|
sdstats->estats[i].muzzy_bytes
|
||||||
&astats->estats[i].dirty_bytes);
|
+= astats->estats[i].muzzy_bytes;
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].muzzy_bytes,
|
sdstats->estats[i].retained_bytes
|
||||||
&astats->estats[i].muzzy_bytes);
|
+= astats->estats[i].retained_bytes;
|
||||||
ctl_accum_atomic_zu(&sdstats->estats[i].retained_bytes,
|
|
||||||
&astats->estats[i].retained_bytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3150,29 +3148,17 @@ stats_arenas_i_lextents_j_index(tsdn_t *tsdn, const size_t *mib,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_ndirty,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_ndirty,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].ndirty, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].ndirty,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_nmuzzy,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_nmuzzy,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].nmuzzy, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].nmuzzy,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_nretained,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_nretained,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].nretained, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].nretained,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_dirty_bytes,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_dirty_bytes,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].dirty_bytes, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].dirty_bytes,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_muzzy_bytes,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_muzzy_bytes,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].muzzy_bytes, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].muzzy_bytes,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_retained_bytes,
|
CTL_RO_CGEN(config_stats, stats_arenas_i_extents_j_retained_bytes,
|
||||||
atomic_load_zu(
|
arenas_i(mib[2])->astats->estats[mib[4]].retained_bytes, size_t);
|
||||||
&arenas_i(mib[2])->astats->estats[mib[4]].retained_bytes,
|
|
||||||
ATOMIC_RELAXED), size_t);
|
|
||||||
|
|
||||||
static const ctl_named_node_t *
|
static const ctl_named_node_t *
|
||||||
stats_arenas_i_extents_j_index(tsdn_t *tsdn, const size_t *mib,
|
stats_arenas_i_extents_j_index(tsdn_t *tsdn, const size_t *mib,
|
||||||
|
Loading…
Reference in New Issue
Block a user