forked from wahern/timeout
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbench-wheel.c
57 lines (38 loc) · 995 Bytes
/
bench-wheel.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "timeout.h"
#include "timeout.c"
#include "bench.h"
static struct timeouts timeouts;
static void init(struct timeout *timeout, size_t count, int verbose) {
size_t i;
timeouts_init(&timeouts, TIMEOUT_mHZ);
for (i = 0; i < count; i++) {
timeout_init(&timeout[i], 0);
}
#if TIMEOUT_DEBUG - 0
timeout_debug = verbose;
#endif
} /* init() */
static void add(struct timeout *to, timeout_t expires) {
timeouts_add(&timeouts, to, expires);
} /* add() */
static void del(struct timeout *to) {
timeouts_del(&timeouts, to);
} /* del() */
static struct timeout *get(void) {
return timeouts_get(&timeouts);
} /* get() */
static void update(timeout_t ts) {
timeouts_update(&timeouts, ts);
} /* update() */
static void (check)(void) {
if (!timeouts_check(&timeouts, stderr))
_Exit(1);
} /* check() */
const struct vops VOPS = {
.init = &init,
.add = &add,
.del = &del,
.get = &get,
.update = &update,
.check = &check,
};