+/*
+ * What type of allocation to use for io buffers
+ */
+enum fio_memtype {
+ MEM_MALLOC = 0, /* ordinary malloc */
+ MEM_SHM, /* use shared memory segments */
+ MEM_SHMHUGE, /* use shared memory segments with huge pages */
+ MEM_MMAP, /* use anonynomous mmap */
+ MEM_MMAPHUGE, /* memory mapped huge file */
+};
+
+/*
+ * The type of object we are working on
+ */
+enum fio_filetype {
+ FIO_TYPE_FILE = 1, /* plain file */
+ FIO_TYPE_BD, /* block device */
+ FIO_TYPE_CHAR, /* character device */
+};
+
+enum fio_ioengine_flags {
+ FIO_SYNCIO = 1 << 0, /* io engine has synchronous ->queue */
+ FIO_CPUIO = 1 << 1, /* cpu burner, doesn't do real io */
+ FIO_MMAPIO = 1 << 2, /* uses memory mapped io */
+ FIO_RAWIO = 1 << 3, /* some sort of direct/raw io */
+ FIO_NETIO = 1 << 4, /* networked io */
+ FIO_NULLIO = 1 << 5, /* no real data transfer (cpu/null) */
+};
+
+/*
+ * Each thread_data structure has a number of files associated with it,
+ * this structure holds state information for a single file.
+ */
+struct fio_file {
+ /*
+ * A file may not be a file descriptor, let the io engine decide
+ */
+ union {
+ unsigned long file_data;
+ int fd;
+ };
+ char *file_name;
+ void *mmap;
+ unsigned long long file_size;
+ unsigned long long real_file_size;
+ unsigned long long file_offset;
+ unsigned long long last_pos;
+ unsigned long long last_completed_pos;
+
+ /*
+ * block map for random io
+ */
+ unsigned long *file_map;
+ unsigned int num_maps;
+ unsigned int last_free_lookup;
+
+ unsigned int unlink;
+};
+
+struct thread_stat {
+ struct io_log *slat_log;
+ struct io_log *clat_log;
+ struct io_log *bw_log;
+
+ /*
+ * bandwidth and latency stats
+ */
+ struct io_stat clat_stat[2]; /* completion latency */
+ struct io_stat slat_stat[2]; /* submission latency */
+ struct io_stat bw_stat[2]; /* bandwidth stats */
+
+ unsigned long long stat_io_bytes[2];
+ struct timeval stat_sample_time[2];
+
+ /*
+ * fio system usage accounting
+ */
+ struct rusage ru_start;
+ struct rusage ru_end;
+ unsigned long usr_time;
+ unsigned long sys_time;
+ unsigned long ctx;
+};
+
+/*
+ * How many depth levels to log
+ */
+#define FIO_IO_U_MAP_NR 8
+#define FIO_IO_U_LAT_NR 12
+
+/*
+ * This describes a single thread/process executing a fio job.
+ */