8 #include <sys/resource.h>
18 unsigned long max_val;
19 unsigned long min_val;
20 unsigned long samples;
29 unsigned long nr_samples;
30 unsigned long max_samples;
31 struct io_sample *log;
35 struct list_head list;
36 unsigned long long offset;
40 #define FIO_HDR_MAGIC 0xf00baaef
42 struct verify_header {
43 unsigned int fio_magic;
45 char md5_digest[MD5_HASH_WORDS * 4];
48 struct group_run_stats {
49 unsigned long max_run[2], min_run[2];
50 unsigned long max_bw[2], min_bw[2];
51 unsigned long io_mb[2];
65 volatile int terminate;
66 volatile int runstate;
67 volatile int old_runstate;
70 unsigned int sequential;
75 unsigned int thinktime;
76 unsigned int fsync_blocks;
77 unsigned int start_delay;
80 unsigned int create_file;
81 unsigned int overwrite;
82 unsigned int invalidate_cache;
83 unsigned int bw_avg_time;
84 unsigned int create_serialize;
85 unsigned int create_fsync;
87 unsigned long long file_size;
88 unsigned long long file_offset;
90 unsigned int mem_type;
92 unsigned int stonewall;
94 unsigned int use_thread;
97 struct drand48_data bsrange_state;
98 struct drand48_data verify_state;
104 io_context_t aio_ctx;
105 unsigned int aio_depth;
106 struct io_event *aio_events;
108 unsigned int cur_depth;
109 struct list_head io_u_freelist;
110 struct list_head io_u_busylist;
113 unsigned int ratemin;
114 unsigned int ratecycle;
115 unsigned long rate_usec_cycle;
116 long rate_pending_usleep;
117 unsigned long rate_bytes;
118 struct timeval lastrate;
120 unsigned long runtime; /* sec */
121 unsigned long long io_size;
123 unsigned long io_blocks;
124 unsigned long io_bytes;
125 unsigned long this_io_bytes;
126 unsigned long last_bytes;
129 struct drand48_data random_state;
130 unsigned long *file_map;
131 unsigned int num_maps;
134 * bandwidth and latency stats
136 struct io_stat clat_stat; /* completion latency */
137 struct io_stat slat_stat; /* submission latency */
139 struct io_stat bw_stat; /* bandwidth stats */
140 unsigned long stat_io_bytes;
141 struct timeval stat_sample_time;
143 struct io_log *lat_log;
144 struct io_log *bw_log;
146 struct timeval start;
148 struct rusage ru_start;
149 struct rusage ru_end;
150 unsigned long usr_time;
151 unsigned long sys_time;
154 struct list_head io_hist_list;
157 extern int parse_jobs_ini(char *);
158 extern int parse_options(int, char **);
159 extern void finish_log(struct thread_data *, struct io_log *, const char *);
160 extern int init_random_state(struct thread_data *);
162 extern int rate_quit;
163 extern int write_lat_log;
164 extern int write_bw_log;
165 extern int exitall_on_terminate;
166 extern int thread_number;
170 extern char run_str[];
172 extern struct thread_data *threads;
184 #define td_read(td) ((td)->ddir == DDIR_READ)
185 #define td_write(td) ((td)->ddir == DDIR_WRITE)
187 #define BLOCKS_PER_MAP (8 * sizeof(long))
188 #define TO_MAP_BLOCK(td, b) ((b) - ((td)->file_offset / (td)->min_bs))
189 #define RAND_MAP_IDX(td, b) (TO_MAP_BLOCK(td, b) / BLOCKS_PER_MAP)
190 #define RAND_MAP_BIT(td, b) (TO_MAP_BLOCK(td, b) & (BLOCKS_PER_MAP - 1))
192 #define MAX_JOBS (1024)