1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
4 typedef struct ticker_s ticker_t;
6 #endif /* JEMALLOC_H_TYPES */
7 /******************************************************************************/
8 #ifdef JEMALLOC_H_STRUCTS
15 #endif /* JEMALLOC_H_STRUCTS */
16 /******************************************************************************/
17 #ifdef JEMALLOC_H_EXTERNS
19 #endif /* JEMALLOC_H_EXTERNS */
20 /******************************************************************************/
21 #ifdef JEMALLOC_H_INLINES
23 #ifndef JEMALLOC_ENABLE_INLINE
24 void ticker_init(ticker_t *ticker, int32_t nticks);
25 void ticker_copy(ticker_t *ticker, const ticker_t *other);
26 int32_t ticker_read(const ticker_t *ticker);
27 bool ticker_ticks(ticker_t *ticker, int32_t nticks);
28 bool ticker_tick(ticker_t *ticker);
31 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TICKER_C_))
33 ticker_init(ticker_t *ticker, int32_t nticks)
36 ticker->tick = nticks;
37 ticker->nticks = nticks;
41 ticker_copy(ticker_t *ticker, const ticker_t *other)
47 JEMALLOC_INLINE int32_t
48 ticker_read(const ticker_t *ticker)
51 return (ticker->tick);
55 ticker_ticks(ticker_t *ticker, int32_t nticks)
58 if (unlikely(ticker->tick < nticks)) {
59 ticker->tick = ticker->nticks;
62 ticker->tick -= nticks;
67 ticker_tick(ticker_t *ticker)
70 return (ticker_ticks(ticker, 1));
74 #endif /* JEMALLOC_H_INLINES */
75 /******************************************************************************/