TODO: man page missing
[fio.git] / fio.h
diff --git a/fio.h b/fio.h
index 33b431939a9ee916e297ed0b62f8a5fce7eb4235..ed2abe79618e210b3a316ec5edd0c94feacfd55b 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -122,6 +122,43 @@ struct zone_split_index {
        uint8_t size_perc_prev;
 };
 
+/*
+ * For steady state detection
+ */
+struct steadystate_data {
+       double limit;
+       unsigned long long dur;
+       unsigned long long ramp_time;
+       bool (*evaluate)(unsigned long, unsigned long, struct thread_data *);
+       bool check_iops;
+       bool check_slope;
+       bool pct;
+
+       int attained;
+       int last_in_group;
+       int ramp_time_over;
+
+       unsigned int head;
+       unsigned int tail;
+       unsigned long *iops_data;
+       unsigned long *bw_data;
+
+       double slope;
+       double criterion;
+       double deviation;
+
+       unsigned long long sum_y;
+       unsigned long long sum_x;
+       unsigned long long sum_x_sq;
+       unsigned long long sum_xy;
+       unsigned long long oldest_y;
+
+       struct timeval prev_time;
+       unsigned long long prev_iops;
+       unsigned long long prev_bytes;
+};
+
+
 /*
  * This describes a single thread/process executing a fio job.
  */
@@ -394,6 +431,8 @@ struct thread_data {
 
        void *pinned_mem;
 
+       struct steadystate_data ss;
+
        char verror[FIO_VERROR_SIZE];
 };
 
@@ -469,6 +508,9 @@ extern char *trigger_remote_cmd;
 extern long long trigger_timeout;
 extern char *aux_path;
 
+extern bool steadystate;
+#define STEADYSTATE_MSEC (1000)
+
 extern struct thread_data *threads;
 
 static inline void fio_ro_check(const struct thread_data *td, struct io_u *io_u)
@@ -556,8 +598,27 @@ enum {
        TD_EXITED,
        TD_REAPED,
        TD_LAST,
+       TD_NR,
 };
 
+#define TD_ENG_FLAG_SHIFT      16
+#define TD_ENG_FLAG_MASK       ((1U << 16) - 1)
+
+static inline enum fio_ioengine_flags td_ioengine_flags(struct thread_data *td)
+{
+       return (td->flags >> TD_ENG_FLAG_SHIFT) & TD_ENG_FLAG_MASK;
+}
+
+static inline void td_set_ioengine_flags(struct thread_data *td)
+{
+       td->flags |= (td->io_ops->flags << TD_ENG_FLAG_SHIFT);
+}
+
+static inline bool td_ioengine_flagged(struct thread_data *td, unsigned int val)
+{
+       return ((td->flags >> TD_ENG_FLAG_SHIFT) & val) != 0;
+}
+
 extern void td_set_runstate(struct thread_data *, int);
 extern int td_bump_runstate(struct thread_data *, int);
 extern void td_restore_runstate(struct thread_data *, int);
@@ -766,6 +827,14 @@ enum {
        FIO_CPUS_SPLIT,
 };
 
+enum {
+       FIO_STEADYSTATE_IOPS    = 0,
+       FIO_STEADYSTATE_IOPS_SLOPE,
+       FIO_STEADYSTATE_BW,
+       FIO_STEADYSTATE_BW_SLOPE,
+};
+
+
 extern void exec_trigger(const char *);
 extern void check_trigger_file(void);