Fix io piece logging to not have O(n) runtime
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index 1fb01d9522f5f2d4bd20babd81cc227bb87238e4..4111bffbef7cfacb5ad8f1dfe27265bf898880ec 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -14,6 +14,7 @@
 #include <getopt.h>
 
 #include "list.h"
+#include "rbtree.h"
 #include "md5.h"
 #include "crc32.h"
 #include "arch.h"
@@ -78,7 +79,10 @@ struct io_log {
  * When logging io actions, this matches a single sent io_u
  */
 struct io_piece {
-       struct list_head list;
+       union {
+               struct rb_node rb_node;
+               struct list_head list;
+       };
        struct fio_file *file;
        unsigned long long offset;
        unsigned long len;
@@ -325,6 +329,7 @@ struct thread_options {
        char *opendir;
        char *ioengine;
        enum td_ddir td_ddir;
+       unsigned int ddir_nr;
        unsigned int iodepth;
        unsigned int iodepth_low;
        unsigned int iodepth_batch;
@@ -385,6 +390,7 @@ struct thread_options {
        unsigned int nice;
        unsigned int file_service_type;
        unsigned int group_reporting;
+       unsigned int fadvise_hint;
 
        char *read_iolog_file;
        char *write_iolog_file;
@@ -493,6 +499,8 @@ struct thread_data {
 
        struct timeval start;   /* start of this loop */
        struct timeval epoch;   /* time job was started */
+       struct timeval rw_end[2];
+       unsigned int rw_end_set[2];
 
        /*
         * read/write mixed workload state
@@ -501,11 +509,12 @@ struct thread_data {
        unsigned long long rwmix_bytes;
        struct timeval rwmix_switch;
        enum fio_ddir rwmix_ddir;
+       unsigned int ddir_nr;
 
        /*
         * IO historic logs
         */
-       struct list_head io_hist_list;
+       struct rb_root io_hist_tree;
        struct list_head io_log_list;
 
        /*
@@ -686,6 +695,8 @@ extern int fio_cmd_option_parse(struct thread_data *, const char *, char *);
 extern void fio_fill_default_options(struct thread_data *);
 extern int fio_show_option_help(const char *);
 extern void fio_options_dup_and_init(struct option *);
+extern void options_mem_dupe(struct thread_data *);
+extern void options_mem_free(struct thread_data *);
 #define FIO_GETOPT_JOB         0x89988998
 #define FIO_NR_OPTIONS         128
 
@@ -703,6 +714,7 @@ extern void get_file(struct fio_file *);
 extern void put_file(struct thread_data *, struct fio_file *);
 extern int add_dir_files(struct thread_data *, const char *);
 extern int init_random_map(struct thread_data *);
+extern void dup_files(struct thread_data *, struct thread_data *);
 
 /*
  * ETA/status stuff