Rizin
unix-like reverse engineering framework and cli tools
ticker.h
Go to the documentation of this file.
1
/******************************************************************************/
2
#ifdef JEMALLOC_H_TYPES
3
4
typedef
struct
ticker_s ticker_t;
5
6
#endif
/* JEMALLOC_H_TYPES */
7
/******************************************************************************/
8
#ifdef JEMALLOC_H_STRUCTS
9
10
struct
ticker_s {
11
int32_t
tick
;
12
int32_t
nticks;
13
};
14
15
#endif
/* JEMALLOC_H_STRUCTS */
16
/******************************************************************************/
17
#ifdef JEMALLOC_H_EXTERNS
18
19
#endif
/* JEMALLOC_H_EXTERNS */
20
/******************************************************************************/
21
#ifdef JEMALLOC_H_INLINES
22
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);
29
#endif
30
31
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TICKER_C_))
32
JEMALLOC_INLINE
void
33
ticker_init
(ticker_t *ticker,
int32_t
nticks)
34
{
35
36
ticker->tick = nticks;
37
ticker->nticks = nticks;
38
}
39
40
JEMALLOC_INLINE
void
41
ticker_copy
(ticker_t *ticker,
const
ticker_t *other)
42
{
43
44
*ticker = *other;
45
}
46
47
JEMALLOC_INLINE
int32_t
48
ticker_read
(
const
ticker_t *ticker)
49
{
50
51
return
(ticker->tick);
52
}
53
54
JEMALLOC_INLINE
bool
55
ticker_ticks
(ticker_t *ticker,
int32_t
nticks)
56
{
57
58
if
(
unlikely
(ticker->tick < nticks)) {
59
ticker->tick = ticker->nticks;
60
return
(
true
);
61
}
62
ticker->tick -= nticks;
63
return
(
false
);
64
}
65
66
JEMALLOC_INLINE
bool
67
ticker_tick
(ticker_t *ticker)
68
{
69
70
return
(
ticker_ticks
(ticker, 1));
71
}
72
#endif
73
74
#endif
/* JEMALLOC_H_INLINES */
75
/******************************************************************************/
JEMALLOC_INLINE
#define JEMALLOC_INLINE
Definition:
jemalloc_internal_macros.h:28
unlikely
#define unlikely(expr)
Definition:
lz4.c:177
ticker_copy
#define ticker_copy
Definition:
private_namespace.h:547
ticker_read
#define ticker_read
Definition:
private_namespace.h:549
ticker_init
#define ticker_init
Definition:
private_namespace.h:548
ticker_ticks
#define ticker_ticks
Definition:
private_namespace.h:551
ticker_tick
#define ticker_tick
Definition:
private_namespace.h:550
int32_t
int int32_t
Definition:
sftypes.h:33
tick
uv_timer_t tick
Definition:
main.c:8
subprojects
rzheap
rz_jemalloc
internal
ticker.h
Generated by
1.9.1