fix typo in HOWTO
[fio.git] / idletime.h
CommitLineData
f2a2ce0e
HL
1#ifndef FIO_IDLETIME_H
2#define FIO_IDLETIME_H
3
4#include "fio.h"
a666cab8 5#include "lib/output_buffer.h"
f2a2ce0e
HL
6
7#define CALIBRATE_RUNS 10
8#define CALIBRATE_SCALE 1000
9#define MAX_CPU_STR_LEN 32
10
11enum {
12 IDLE_PROF_OPT_NONE,
13 IDLE_PROF_OPT_CALI, /* calibration only */
14 IDLE_PROF_OPT_SYSTEM,
15 IDLE_PROF_OPT_PERCPU
16};
17
18enum {
19 IDLE_PROF_STATUS_OK,
20 IDLE_PROF_STATUS_CALI_STOP,
21 IDLE_PROF_STATUS_PROF_STOP,
22 IDLE_PROF_STATUS_ABORT
23};
24
25struct idle_prof_thread {
26 pthread_t thread;
27 int cpu;
28 int state;
29 struct timeval tps;
30 struct timeval tpe;
de8f6de9 31 double cali_time; /* microseconds to finish a unit work */
f2a2ce0e
HL
32 double loops;
33 double idleness;
34 unsigned char *data; /* bytes to be touched */
35 pthread_cond_t cond;
36 pthread_mutex_t init_lock;
37 pthread_mutex_t start_lock;
54ed125b
JA
38
39 os_cpu_mask_t cpu_mask;
f2a2ce0e
HL
40};
41
42struct idle_prof_common {
43 struct idle_prof_thread *ipts;
44 int nr_cpus;
45 int status;
46 int opt;
47 double cali_mean;
48 double cali_stddev;
49 void *buf; /* single data allocation for all threads */
50};
51
52extern int fio_idle_prof_parse_opt(const char *);
53
54extern void fio_idle_prof_init(void);
55extern void fio_idle_prof_start(void);
56extern void fio_idle_prof_stop(void);
57
a666cab8 58extern void show_idle_prof_stats(int, struct json_object *, struct buf_output *);
f2a2ce0e
HL
59
60#endif