2020-01-24 05:18:04 +08:00
|
|
|
#include "jemalloc/internal/jemalloc_preamble.h"
|
|
|
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
|
|
|
|
|
|
|
#include "jemalloc/internal/counter.h"
|
|
|
|
|
|
|
|
bool
|
|
|
|
counter_accum_init(counter_accum_t *counter, uint64_t interval) {
|
2020-04-15 06:08:00 +08:00
|
|
|
if (LOCKEDINT_MTX_INIT(counter->mtx, "counter_accum",
|
2020-01-24 05:18:04 +08:00
|
|
|
WITNESS_RANK_COUNTER_ACCUM, malloc_mutex_rank_exclusive)) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-04-15 06:08:00 +08:00
|
|
|
locked_init_u64_unsynchronized(&counter->accumbytes, 0);
|
2020-01-24 05:18:04 +08:00
|
|
|
counter->interval = interval;
|
|
|
|
return false;
|
|
|
|
}
|
2020-04-16 05:52:01 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
counter_prefork(tsdn_t *tsdn, counter_accum_t *counter) {
|
|
|
|
LOCKEDINT_MTX_PREFORK(tsdn, counter->mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
counter_postfork_parent(tsdn_t *tsdn, counter_accum_t *counter) {
|
|
|
|
LOCKEDINT_MTX_POSTFORK_PARENT(tsdn, counter->mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
counter_postfork_child(tsdn_t *tsdn, counter_accum_t *counter) {
|
|
|
|
LOCKEDINT_MTX_POSTFORK_CHILD(tsdn, counter->mtx);
|
|
|
|
}
|