X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;ds=sidebyside;f=steadystate.h;h=f390b073eec564b015519d0626d0baeb981705b0;hb=17df7023156b50ee7288eea0f118f1ac20b21ea2;hp=039ffc900acbe37085f65962d8190ae3408043c8;hpb=16e56d250f72e4fec4591d562a5f4d7a16ba1bb8;p=fio.git diff --git a/steadystate.h b/steadystate.h index 039ffc90..f390b073 100644 --- a/steadystate.h +++ b/steadystate.h @@ -1,9 +1,61 @@ #ifndef FIO_STEADYSTATE_H #define FIO_STEADYSTATE_H +#include "stat.h" +#include "thread_options.h" +#include "lib/ieee754.h" + extern void 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 unsigned long long steadystate_bw_mean(struct thread_stat *); +extern unsigned long long 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; + 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_DATA = 32, + __FIO_SS_PCT = 64, + __FIO_SS_BUFFER_FULL = 128, + + 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