PA: Move in mutex stats reading.
This commit is contained in:
parent
07675840a5
commit
daefde88fe
@ -260,4 +260,13 @@ void pa_shard_stats_merge(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
pa_shard_stats_t *shard_stats_out, pa_extent_stats_t *extent_stats_out,
|
||||
size_t *resident);
|
||||
|
||||
/*
|
||||
* Reads the PA-owned mutex stats into the output stats array, at the
|
||||
* appropriate positions. Morally, these stats should really live in
|
||||
* pa_shard_stats_t, but the indices are sort of baked into the various mutex
|
||||
* prof macros. This would be a good thing to do at some point.
|
||||
*/
|
||||
void pa_shard_mtx_stats_read(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
mutex_prof_data_t mutex_prof_data[mutex_prof_num_arena_mutexes]);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_PA_H */
|
||||
|
16
src/arena.c
16
src/arena.c
@ -173,21 +173,11 @@ arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
|
||||
|
||||
/* Gather per arena mutex profiling data. */
|
||||
READ_ARENA_MUTEX_PROF_DATA(large_mtx, arena_prof_mutex_large);
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.edata_cache.mtx,
|
||||
arena_prof_mutex_extent_avail)
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.ecache_dirty.mtx,
|
||||
arena_prof_mutex_extents_dirty)
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.ecache_muzzy.mtx,
|
||||
arena_prof_mutex_extents_muzzy)
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.ecache_retained.mtx,
|
||||
arena_prof_mutex_extents_retained)
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.decay_dirty.mtx,
|
||||
arena_prof_mutex_decay_dirty)
|
||||
READ_ARENA_MUTEX_PROF_DATA(pa_shard.decay_muzzy.mtx,
|
||||
arena_prof_mutex_decay_muzzy)
|
||||
READ_ARENA_MUTEX_PROF_DATA(base->mtx,
|
||||
arena_prof_mutex_base)
|
||||
arena_prof_mutex_base);
|
||||
#undef READ_ARENA_MUTEX_PROF_DATA
|
||||
pa_shard_mtx_stats_read(tsdn, &arena->pa_shard,
|
||||
astats->mutex_prof_data);
|
||||
|
||||
nstime_copy(&astats->uptime, &arena->create_time);
|
||||
nstime_update(&astats->uptime);
|
||||
|
@ -127,3 +127,28 @@ pa_shard_stats_merge(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
extent_stats_out[i].retained_bytes = retained_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pa_shard_mtx_stats_read_single(tsdn_t *tsdn, mutex_prof_data_t *mutex_prof_data,
|
||||
malloc_mutex_t *mtx, int ind) {
|
||||
malloc_mutex_lock(tsdn, mtx);
|
||||
malloc_mutex_prof_read(tsdn, &mutex_prof_data[ind], mtx);
|
||||
malloc_mutex_unlock(tsdn, mtx);
|
||||
}
|
||||
|
||||
void
|
||||
pa_shard_mtx_stats_read(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
mutex_prof_data_t mutex_prof_data[mutex_prof_num_arena_mutexes]) {
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->edata_cache.mtx, arena_prof_mutex_extent_avail);
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->ecache_dirty.mtx, arena_prof_mutex_extents_dirty);
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->ecache_muzzy.mtx, arena_prof_mutex_extents_muzzy);
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->ecache_retained.mtx, arena_prof_mutex_extents_retained);
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->decay_dirty.mtx, arena_prof_mutex_decay_dirty);
|
||||
pa_shard_mtx_stats_read_single(tsdn, mutex_prof_data,
|
||||
&shard->decay_muzzy.mtx, arena_prof_mutex_decay_muzzy);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user