Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit c54f93f

Browse files
committed
Merge pull request #114 from thestinger/timer
avoid conflict with the POSIX timer_t type
2 parents 423d78a + c3bfe95 commit c54f93f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

test/include/test/timer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
typedef struct {
88
struct timeval tv0;
99
struct timeval tv1;
10-
} timer_t;
10+
} timedelta_t;
1111

12-
void timer_start(timer_t *timer);
13-
void timer_stop(timer_t *timer);
14-
uint64_t timer_usec(const timer_t *timer);
15-
void timer_ratio(timer_t *a, timer_t *b, char *buf, size_t buflen);
12+
void timer_start(timedelta_t *timer);
13+
void timer_stop(timedelta_t *timer);
14+
uint64_t timer_usec(const timedelta_t *timer);
15+
void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen);

test/src/timer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
#include "test/jemalloc_test.h"
22

33
void
4-
timer_start(timer_t *timer)
4+
timer_start(timedelta_t *timer)
55
{
66

77
gettimeofday(&timer->tv0, NULL);
88
}
99

1010
void
11-
timer_stop(timer_t *timer)
11+
timer_stop(timedelta_t *timer)
1212
{
1313

1414
gettimeofday(&timer->tv1, NULL);
1515
}
1616

1717
uint64_t
18-
timer_usec(const timer_t *timer)
18+
timer_usec(const timedelta_t *timer)
1919
{
2020

2121
return (((timer->tv1.tv_sec - timer->tv0.tv_sec) * 1000000) +
2222
timer->tv1.tv_usec - timer->tv0.tv_usec);
2323
}
2424

2525
void
26-
timer_ratio(timer_t *a, timer_t *b, char *buf, size_t buflen)
26+
timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen)
2727
{
2828
uint64_t t0 = timer_usec(a);
2929
uint64_t t1 = timer_usec(b);

test/stress/microbench.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "test/jemalloc_test.h"
22

33
JEMALLOC_INLINE_C void
4-
time_func(timer_t *timer, uint64_t nwarmup, uint64_t niter, void (*func)(void))
4+
time_func(timedelta_t *timer, uint64_t nwarmup, uint64_t niter, void (*func)(void))
55
{
66
uint64_t i;
77

@@ -17,7 +17,7 @@ void
1717
compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
1818
void (*func_a), const char *name_b, void (*func_b))
1919
{
20-
timer_t timer_a, timer_b;
20+
timedelta_t timer_a, timer_b;
2121
char ratio_buf[6];
2222

2323
time_func(&timer_a, nwarmup, niter, func_a);

0 commit comments

Comments
 (0)