Home | History | Annotate | Download | only in fio
      1 #ifndef FIO_STEADYSTATE_H
      2 #define FIO_STEADYSTATE_H
      3 
      4 #include "stat.h"
      5 #include "thread_options.h"
      6 #include "lib/ieee754.h"
      7 
      8 extern void steadystate_check(void);
      9 extern void steadystate_setup(void);
     10 extern int td_steadystate_init(struct thread_data *);
     11 extern uint64_t steadystate_bw_mean(struct thread_stat *);
     12 extern uint64_t steadystate_iops_mean(struct thread_stat *);
     13 
     14 extern bool steadystate_enabled;
     15 
     16 struct steadystate_data {
     17 	double limit;
     18 	unsigned long long dur;
     19 	unsigned long long ramp_time;
     20 
     21 	uint32_t state;
     22 
     23 	unsigned int head;
     24 	unsigned int tail;
     25 	uint64_t *iops_data;
     26 	uint64_t *bw_data;
     27 
     28 	double slope;
     29 	double deviation;
     30 	double criterion;
     31 
     32 	uint64_t sum_y;
     33 	uint64_t sum_x;
     34 	uint64_t sum_x_sq;
     35 	uint64_t sum_xy;
     36 	uint64_t oldest_y;
     37 
     38 	struct timeval prev_time;
     39 	uint64_t prev_iops;
     40 	uint64_t prev_bytes;
     41 };
     42 
     43 enum {
     44 	__FIO_SS_IOPS		= 1,
     45 	__FIO_SS_BW		= 2,
     46 	__FIO_SS_SLOPE		= 4,
     47 	__FIO_SS_ATTAINED	= 8,
     48 	__FIO_SS_RAMP_OVER	= 16,
     49 	__FIO_SS_DATA		= 32,
     50 	__FIO_SS_PCT		= 64,
     51 	__FIO_SS_BUFFER_FULL	= 128,
     52 
     53 	FIO_SS_IOPS		= __FIO_SS_IOPS,
     54 	FIO_SS_IOPS_SLOPE	= __FIO_SS_IOPS | __FIO_SS_SLOPE,
     55 	FIO_SS_BW		= __FIO_SS_BW,
     56 	FIO_SS_BW_SLOPE		= __FIO_SS_BW | __FIO_SS_SLOPE,
     57 };
     58 
     59 #define STEADYSTATE_MSEC	1000
     60 
     61 #endif
     62