mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-28 03:13:09 +03:00
Chagne prof_accum_t to counter_accum_t for general purpose.
This commit is contained in:
parent
ea351a7b52
commit
d71a145ec1
14 changed files with 125 additions and 84 deletions
22
src/counter.c
Normal file
22
src/counter.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#define JEMALLOC_COUNTER_C_
|
||||
#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) {
|
||||
#ifndef JEMALLOC_ATOMIC_U64
|
||||
if (malloc_mutex_init(&counter->mtx, "counter_accum",
|
||||
WITNESS_RANK_COUNTER_ACCUM, malloc_mutex_rank_exclusive)) {
|
||||
return true;
|
||||
}
|
||||
counter->accumbytes = 0;
|
||||
#else
|
||||
atomic_store_u64(&counter->accumbytes, 0,
|
||||
ATOMIC_RELAXED);
|
||||
#endif
|
||||
counter->interval = interval;
|
||||
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue