summaryrefslogtreecommitdiff
path: root/deps/jemalloc/src/counter.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2023-05-01 15:38:08 +0300
committerOran Agra <oran@redislabs.com>2023-05-01 15:38:08 +0300
commitb8beda3cf8e5c8218fbe84539d6b5117b3f909d9 (patch)
tree66934c98c93ac48f6ca912ad547e651221e525d2 /deps/jemalloc/src/counter.c
parentd659c734569be4ed32a270bac2527ccf35418c43 (diff)
parent6d23d3ac3b3f9d13ad2ce99029e69a9ea9f2e517 (diff)
downloadredis-b8beda3cf8e5c8218fbe84539d6b5117b3f909d9.tar.gz
Merge commit jemalloc 5.3.0
Diffstat (limited to 'deps/jemalloc/src/counter.c')
-rw-r--r--deps/jemalloc/src/counter.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/jemalloc/src/counter.c b/deps/jemalloc/src/counter.c
new file mode 100644
index 000000000..8f1ae3af4
--- /dev/null
+++ b/deps/jemalloc/src/counter.c
@@ -0,0 +1,30 @@
+#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) {
+ 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);
+}