summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/jemalloc/internal/arena_inlines_b.h1
-rw-r--r--include/jemalloc/internal/arena_structs_b.h1
-rw-r--r--include/jemalloc/internal/jemalloc_internal_includes.h3
-rw-r--r--include/jemalloc/internal/jemalloc_internal_inlines_a.h1
-rw-r--r--include/jemalloc/internal/tcache_inlines.h1
-rw-r--r--include/jemalloc/internal/tcache_structs.h1
-rw-r--r--include/jemalloc/internal/ticker.h (renamed from include/jemalloc/internal/ticker_inlines.h)19
-rw-r--r--include/jemalloc/internal/ticker_structs.h9
-rw-r--r--include/jemalloc/internal/ticker_types.h6
-rw-r--r--src/jemalloc.c1
-rw-r--r--test/unit/decay.c2
-rw-r--r--test/unit/ticker.c2
12 files changed, 26 insertions, 21 deletions
diff --git a/include/jemalloc/internal/arena_inlines_b.h b/include/jemalloc/internal/arena_inlines_b.h
index 526103b..054757d 100644
--- a/include/jemalloc/internal/arena_inlines_b.h
+++ b/include/jemalloc/internal/arena_inlines_b.h
@@ -2,6 +2,7 @@
#define JEMALLOC_INTERNAL_ARENA_INLINES_B_H
#include "jemalloc/internal/jemalloc_internal_types.h"
+#include "jemalloc/internal/ticker.h"
static inline szind_t
arena_bin_index(arena_t *arena, arena_bin_t *bin) {
diff --git a/include/jemalloc/internal/arena_structs_b.h b/include/jemalloc/internal/arena_structs_b.h
index f2195f6..7b133f2 100644
--- a/include/jemalloc/internal/arena_structs_b.h
+++ b/include/jemalloc/internal/arena_structs_b.h
@@ -4,6 +4,7 @@
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/nstime.h"
#include "jemalloc/internal/ql.h"
+#include "jemalloc/internal/ticker.h"
/*
* Read-only information associated with each element of arena_t's bins array
diff --git a/include/jemalloc/internal/jemalloc_internal_includes.h b/include/jemalloc/internal/jemalloc_internal_includes.h
index 5e80f96..8ce7864 100644
--- a/include/jemalloc/internal/jemalloc_internal_includes.h
+++ b/include/jemalloc/internal/jemalloc_internal_includes.h
@@ -40,7 +40,6 @@
/* TYPES */
/******************************************************************************/
-#include "jemalloc/internal/ticker_types.h"
#include "jemalloc/internal/ckh_types.h"
#include "jemalloc/internal/size_classes.h"
#include "jemalloc/internal/smoothstep.h"
@@ -63,7 +62,6 @@
/* STRUCTS */
/******************************************************************************/
-#include "jemalloc/internal/ticker_structs.h"
#include "jemalloc/internal/ckh_structs.h"
#include "jemalloc/internal/witness_structs.h"
#include "jemalloc/internal/mutex_structs.h"
@@ -107,7 +105,6 @@
/* INLINES */
/******************************************************************************/
-#include "jemalloc/internal/ticker_inlines.h"
#include "jemalloc/internal/tsd_inlines.h"
#include "jemalloc/internal/witness_inlines.h"
#include "jemalloc/internal/mutex_inlines.h"
diff --git a/include/jemalloc/internal/jemalloc_internal_inlines_a.h b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
index 9cb933c..06a5c71 100644
--- a/include/jemalloc/internal/jemalloc_internal_inlines_a.h
+++ b/include/jemalloc/internal/jemalloc_internal_inlines_a.h
@@ -4,6 +4,7 @@
#include "jemalloc/internal/atomic.h"
#include "jemalloc/internal/bit_util.h"
#include "jemalloc/internal/jemalloc_internal_types.h"
+#include "jemalloc/internal/ticker.h"
JEMALLOC_ALWAYS_INLINE pszind_t
psz2ind(size_t psz) {
diff --git a/include/jemalloc/internal/tcache_inlines.h b/include/jemalloc/internal/tcache_inlines.h
index 8b42af6..25931d8 100644
--- a/include/jemalloc/internal/tcache_inlines.h
+++ b/include/jemalloc/internal/tcache_inlines.h
@@ -2,6 +2,7 @@
#define JEMALLOC_INTERNAL_TCACHE_INLINES_H
#include "jemalloc/internal/jemalloc_internal_types.h"
+#include "jemalloc/internal/ticker.h"
#include "jemalloc/internal/util.h"
static inline bool
diff --git a/include/jemalloc/internal/tcache_structs.h b/include/jemalloc/internal/tcache_structs.h
index fe27f36..c01098f 100644
--- a/include/jemalloc/internal/tcache_structs.h
+++ b/include/jemalloc/internal/tcache_structs.h
@@ -2,6 +2,7 @@
#define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H
#include "jemalloc/internal/ql.h"
+#include "jemalloc/internal/ticker.h"
/*
* Read-only information associated with each element of tcache_t's tbins array
diff --git a/include/jemalloc/internal/ticker_inlines.h b/include/jemalloc/internal/ticker.h
index cd5821f..faaac91 100644
--- a/include/jemalloc/internal/ticker_inlines.h
+++ b/include/jemalloc/internal/ticker.h
@@ -1,5 +1,18 @@
-#ifndef JEMALLOC_INTERNAL_TICKER_INLINES_H
-#define JEMALLOC_INTERNAL_TICKER_INLINES_H
+#ifndef JEMALLOC_INTERNAL_TICKER_H
+#define JEMALLOC_INTERNAL_TICKER_H
+
+/**
+ * A ticker makes it easy to count-down events until some limit. You
+ * ticker_init the ticker to trigger every nticks events. You then notify it
+ * that an event has occurred with calls to ticker_tick (or that nticks events
+ * have occurred with a call to ticker_ticks), which will return true (and reset
+ * the counter) if the countdown hit zero.
+ */
+
+typedef struct {
+ int32_t tick;
+ int32_t nticks;
+} ticker_t;
static inline void
ticker_init(ticker_t *ticker, int32_t nticks) {
@@ -32,4 +45,4 @@ ticker_tick(ticker_t *ticker) {
return ticker_ticks(ticker, 1);
}
-#endif /* JEMALLOC_INTERNAL_TICKER_INLINES_H */
+#endif /* JEMALLOC_INTERNAL_TICKER_H */
diff --git a/include/jemalloc/internal/ticker_structs.h b/include/jemalloc/internal/ticker_structs.h
deleted file mode 100644
index e30c4e2..0000000
--- a/include/jemalloc/internal/ticker_structs.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_TICKER_STRUCTS_H
-#define JEMALLOC_INTERNAL_TICKER_STRUCTS_H
-
-struct ticker_s {
- int32_t tick;
- int32_t nticks;
-};
-
-#endif /* JEMALLOC_INTERNAL_TICKER_STRUCTS_H */
diff --git a/include/jemalloc/internal/ticker_types.h b/include/jemalloc/internal/ticker_types.h
deleted file mode 100644
index 62d67f3..0000000
--- a/include/jemalloc/internal/ticker_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_TICKER_TYPES_H
-#define JEMALLOC_INTERNAL_TICKER_TYPES_H
-
-typedef struct ticker_s ticker_t;
-
-#endif /* JEMALLOC_INTERNAL_TICKER_TYPES_H */
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 5119499..108258b 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -7,6 +7,7 @@
#include "jemalloc/internal/jemalloc_internal_types.h"
#include "jemalloc/internal/malloc_io.h"
#include "jemalloc/internal/spin.h"
+#include "jemalloc/internal/ticker.h"
#include "jemalloc/internal/util.h"
/******************************************************************************/
diff --git a/test/unit/decay.c b/test/unit/decay.c
index 26359fa..389f6e0 100644
--- a/test/unit/decay.c
+++ b/test/unit/decay.c
@@ -1,5 +1,7 @@
#include "test/jemalloc_test.h"
+#include "jemalloc/internal/ticker.h"
+
static nstime_monotonic_t *nstime_monotonic_orig;
static nstime_update_t *nstime_update_orig;
diff --git a/test/unit/ticker.c b/test/unit/ticker.c
index c2ad729..e5790a3 100644
--- a/test/unit/ticker.c
+++ b/test/unit/ticker.c
@@ -1,5 +1,7 @@
#include "test/jemalloc_test.h"
+#include "jemalloc/internal/ticker.h"
+
TEST_BEGIN(test_ticker_tick) {
#define NREPS 2
#define NTICKS 3