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