jemalloc/src/counter.c
Slobodan Predolac de9ad1450b Drop the jemalloc_internal_includes.h umbrella
Convert the production source files in src/ (69 .c/.cpp) and
test/jemalloc_test.h.in to list the headers they actually use, then
delete the umbrella.  Three consolidated headers (peak_event.h,
prof_sys.h, sz.h) also gain explicit transitive includes.

Every translation unit now declares what it uses.  A missing include
now fails at the failing file rather than silently working because
something upstream pulled in the world.
2026-06-04 11:32:53 -04:00

30 lines
808 B
C

#include "jemalloc/internal/jemalloc_preamble.h"
#include "jemalloc/internal/counter.h"
#include "jemalloc/internal/witness.h"
bool
counter_accum_init(counter_accum_t *counter, uint64_t interval) {
if (LOCKEDINT_MTX_INIT(counter->mtx, "counter_accum",
WITNESS_RANK_COUNTER_ACCUM, malloc_mutex_rank_exclusive)) {
return true;
}
locked_init_u64_unsynchronized(&counter->accumbytes, 0);
counter->interval = interval;
return false;
}
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);
}