X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=steadystate.h;h=51472c4698c0cfd72233a62c34cd1226741138a8;hp=3829ee412e95ae763a65b83ac6729b87f57ce661;hb=39281024d26b5dbd4c70ce7620aeadc8933ac8c7;hpb=ad743db401637bd503d0466c94f735d92248be79 diff --git a/steadystate.h b/steadystate.h index 3829ee41..51472c46 100644 --- a/steadystate.h +++ b/steadystate.h @@ -3,55 +3,65 @@ #include "thread_options.h" +extern void steadystate_free(struct thread_data *); extern void steadystate_check(void); extern void steadystate_setup(void); -extern void td_steadystate_init(struct thread_data *); +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; -/* - * For steady state detection - */ struct steadystate_data { double limit; unsigned long long dur; unsigned long long ramp_time; - bool pct; - unsigned int mode; - int last_in_group; - int ramp_time_over; + uint32_t state; unsigned int head; unsigned int tail; - unsigned long *iops_data; - unsigned long *bw_data; + uint64_t *iops_data; + uint64_t *bw_data; double slope; - double criterion; 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; - 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 timespec prev_time; + uint64_t prev_iops; + uint64_t prev_bytes; +}; - struct timeval prev_time; - unsigned long long prev_iops; - unsigned long long 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_BW = 2, - __FIO_SS_SLOPE = 4, - __FIO_SS_ATTAINED = 8, - - 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, + 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