appveyor: install zlib and minor clean ups
[fio.git] / gettime.h
CommitLineData
a7346816
JA
1#ifndef FIO_GETTIME_H
2#define FIO_GETTIME_H
3
27325ed5
JA
4#include "arch/arch.h"
5
a7346816
JA
6/*
7 * Clock sources
8 */
9enum fio_cs {
10 CS_GTOD = 1,
11 CS_CGETTIME,
12 CS_CPUCLOCK,
01423eae 13 CS_INVAL,
a7346816
JA
14};
15
8b6a404c 16extern void fio_gettime(struct timespec *, void *);
a7346816
JA
17extern void fio_gtod_init(void);
18extern void fio_clock_init(void);
19extern int fio_start_gtod_thread(void);
aad918e4 20extern int fio_monotonic_clocktest(int debug);
5d879392 21extern void fio_local_clock_init(int);
a7346816 22
8b6a404c 23extern struct timespec *fio_ts;
39ab7da2 24
8b6a404c 25static inline int fio_gettime_offload(struct timespec *ts)
27325ed5 26{
76b4a7ef 27 time_t last_sec;
27325ed5 28
8b6a404c 29 if (!fio_ts)
27325ed5
JA
30 return 0;
31
32 do {
33 read_barrier();
8b6a404c
VF
34 last_sec = ts->tv_sec = fio_ts->tv_sec;
35 ts->tv_nsec = fio_ts->tv_nsec;
36 } while (fio_ts->tv_sec != last_sec);
27325ed5
JA
37
38 return 1;
39}
40
79c896a1
JA
41extern void fio_gtod_set_cpu(unsigned int cpu);
42
a7346816 43#endif