Header refactoring: ticker module - remove from the catchall and unify.

This commit is contained in:
David Goldblatt 2017-04-19 13:39:33 -07:00 committed by David Goldblatt
parent fa3ad730c4
commit bf2dc7e678
12 changed files with 26 additions and 21 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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"

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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"
/******************************************************************************/

View File

@ -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;

View File

@ -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