server-skynet-source-3rd-je.../test/include/test/timer.h
Jason Evans 9bad079039 Refactor time_* into nstime_*.
Use a single uint64_t in nstime_t to store nanoseconds rather than using
struct timespec.  This reduces fragility around conversions between long
and uint64_t, especially missing casts that only cause problems on
32-bit platforms.
2016-02-21 21:39:05 -08:00

15 lines
355 B
C

/* Simple timer, for use in benchmark reporting. */
#include <unistd.h>
#include <sys/time.h>
typedef struct {
nstime_t t0;
nstime_t t1;
} timedelta_t;
void timer_start(timedelta_t *timer);
void timer_stop(timedelta_t *timer);
uint64_t timer_usec(const timedelta_t *timer);
void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen);