2017-01-11 10:06:31 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_ARENA_INLINES_A_H
|
|
|
|
#define JEMALLOC_INTERNAL_ARENA_INLINES_A_H
|
|
|
|
|
|
|
|
#ifndef JEMALLOC_ENABLE_INLINE
|
|
|
|
unsigned arena_ind_get(const arena_t *arena);
|
|
|
|
void arena_internal_add(arena_t *arena, size_t size);
|
|
|
|
void arena_internal_sub(arena_t *arena, size_t size);
|
|
|
|
size_t arena_internal_get(arena_t *arena);
|
|
|
|
bool arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes);
|
|
|
|
#endif /* JEMALLOC_ENABLE_INLINE */
|
|
|
|
|
|
|
|
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ARENA_C_))
|
|
|
|
|
|
|
|
JEMALLOC_INLINE unsigned
|
2017-01-16 08:56:30 +08:00
|
|
|
arena_ind_get(const arena_t *arena) {
|
2017-01-20 10:15:45 +08:00
|
|
|
return base_ind_get(arena->base);
|
2017-01-11 10:06:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
JEMALLOC_INLINE void
|
2017-01-16 08:56:30 +08:00
|
|
|
arena_internal_add(arena_t *arena, size_t size) {
|
2017-01-11 10:06:31 +08:00
|
|
|
atomic_add_zu(&arena->stats.internal, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
JEMALLOC_INLINE void
|
2017-01-16 08:56:30 +08:00
|
|
|
arena_internal_sub(arena_t *arena, size_t size) {
|
2017-01-11 10:06:31 +08:00
|
|
|
atomic_sub_zu(&arena->stats.internal, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
JEMALLOC_INLINE size_t
|
2017-01-16 08:56:30 +08:00
|
|
|
arena_internal_get(arena_t *arena) {
|
2017-01-20 10:15:45 +08:00
|
|
|
return atomic_read_zu(&arena->stats.internal);
|
2017-01-11 10:06:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
JEMALLOC_INLINE bool
|
2017-01-16 08:56:30 +08:00
|
|
|
arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes) {
|
2017-01-11 10:06:31 +08:00
|
|
|
cassert(config_prof);
|
|
|
|
|
2017-01-16 08:56:30 +08:00
|
|
|
if (likely(prof_interval == 0)) {
|
2017-01-20 10:15:45 +08:00
|
|
|
return false;
|
2017-01-16 08:56:30 +08:00
|
|
|
}
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2017-02-13 09:03:46 +08:00
|
|
|
return prof_accum_add(tsdn, &arena->prof_accum, accumbytes);
|
2017-01-11 10:06:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ARENA_C_)) */
|
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_ARENA_INLINES_A_H */
|