X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=steadystate.h;h=209314fbee821039a4af0e29a58d8ee4e88e5f57;hp=31e5c3fc42f27ff67ca6a06771e2f9fca0f0c41a;hb=39c7a2ca0c7b3ffc99a8e1f2917ce9d00f318c82;hpb=ba8fb6f6f12800ee3a0e637dfdac4e9aaa6b2123 diff --git a/steadystate.h b/steadystate.h index 31e5c3fc..209314fb 100644 --- a/steadystate.h +++ b/steadystate.h @@ -1,10 +1,59 @@ #ifndef FIO_STEADYSTATE_H #define FIO_STEADYSTATE_H +#include "thread_options.h" + extern void steadystate_check(void); extern void steadystate_setup(void); -extern void steadystate_alloc(struct thread_data *); -extern bool steadystate_deviation(unsigned long, unsigned long, struct thread_data *); -extern bool steadystate_slope(unsigned long, unsigned long, struct thread_data *); -#endif +extern int td_steadystate_init(struct thread_data *); + +extern bool steadystate_enabled; + +/* + * For steady state detection + */ +struct steadystate_data { + double limit; + unsigned long long dur; + unsigned long long ramp_time; + bool pct; + + unsigned int state; + + 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; +}; + +enum { + __FIO_SS_IOPS = 1, + __FIO_SS_BW = 2, + __FIO_SS_SLOPE = 4, + __FIO_SS_ATTAINED = 8, + __FIO_SS_RAMP_OVER = 16, + __FIO_SS_LAST = 32, + + FIO_SS_IOPS = __FIO_SS_IOPS, + FIO_SS_IOPS_SLOPE = __FIO_SS_IOPS | __FIO_SS_SLOPE, + FIO_SS_BW = __FIO_SS_BW, + FIO_SS_BW_SLOPE = __FIO_SS_BW | __FIO_SS_SLOPE, +}; + +#define STEADYSTATE_MSEC 1000 + +#endif