X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=steadystate.h;h=bbb86fbb30a301299882e655e98b00c951cca8d5;hb=0f5234b4d75c4415d87903d26cdd79ee380c7f49;hp=039ffc900acbe37085f65962d8190ae3408043c8;hpb=16e56d250f72e4fec4591d562a5f4d7a16ba1bb8;p=fio.git diff --git a/steadystate.h b/steadystate.h index 039ffc90..bbb86fbb 100644 --- a/steadystate.h +++ b/steadystate.h @@ -1,9 +1,69 @@ #ifndef FIO_STEADYSTATE_H #define FIO_STEADYSTATE_H -extern void steadystate_check(void); +#include "thread_options.h" + +extern void steadystate_free(struct thread_data *); +extern int steadystate_check(void); extern void steadystate_setup(void); -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 uint64_t steadystate_bw_mean(struct thread_stat *); +extern uint64_t steadystate_iops_mean(struct thread_stat *); + +extern bool steadystate_enabled; + +struct steadystate_data { + double limit; + unsigned long long dur; + unsigned long long ramp_time; + + uint32_t state; + + unsigned int head; + unsigned int tail; + uint64_t *iops_data; + uint64_t *bw_data; + + double slope; + double deviation; + double criterion; + uint64_t sum_y; + uint64_t sum_x; + uint64_t sum_x_sq; + uint64_t sum_xy; + uint64_t oldest_y; + + struct timespec prev_time; + uint64_t prev_iops; + uint64_t prev_bytes; +}; + +enum { + __FIO_SS_IOPS = 0, + __FIO_SS_BW, + __FIO_SS_SLOPE, + __FIO_SS_ATTAINED, + __FIO_SS_RAMP_OVER, + __FIO_SS_DATA, + __FIO_SS_PCT, + __FIO_SS_BUFFER_FULL, +}; + +enum { + FIO_SS_IOPS = 1 << __FIO_SS_IOPS, + FIO_SS_BW = 1 << __FIO_SS_BW, + FIO_SS_SLOPE = 1 << __FIO_SS_SLOPE, + FIO_SS_ATTAINED = 1 << __FIO_SS_ATTAINED, + FIO_SS_RAMP_OVER = 1 << __FIO_SS_RAMP_OVER, + FIO_SS_DATA = 1 << __FIO_SS_DATA, + FIO_SS_PCT = 1 << __FIO_SS_PCT, + FIO_SS_BUFFER_FULL = 1 << __FIO_SS_BUFFER_FULL, + + FIO_SS_IOPS_SLOPE = FIO_SS_IOPS | FIO_SS_SLOPE, + FIO_SS_BW_SLOPE = FIO_SS_BW | FIO_SS_SLOPE, +}; + +#define STEADYSTATE_MSEC 1000 + +#endif