| 1 | #ifndef FIO_STEADYSTATE_H |
| 2 | #define FIO_STEADYSTATE_H |
| 3 | |
| 4 | #include "thread_options.h" |
| 5 | |
| 6 | extern void steadystate_check(void); |
| 7 | extern void steadystate_setup(void); |
| 8 | extern int td_steadystate_init(struct thread_data *); |
| 9 | extern unsigned long long steadystate_bw_mean(struct steadystate_data *); |
| 10 | extern unsigned long long steadystate_iops_mean(struct steadystate_data *); |
| 11 | |
| 12 | extern bool steadystate_enabled; |
| 13 | |
| 14 | /* |
| 15 | * For steady state detection |
| 16 | */ |
| 17 | struct steadystate_data { |
| 18 | double limit; |
| 19 | unsigned long long dur; |
| 20 | unsigned long long ramp_time; |
| 21 | |
| 22 | unsigned int state; |
| 23 | |
| 24 | unsigned int head; |
| 25 | unsigned int tail; |
| 26 | unsigned long *iops_data; |
| 27 | unsigned long *bw_data; |
| 28 | |
| 29 | double slope; |
| 30 | double criterion; |
| 31 | double deviation; |
| 32 | |
| 33 | unsigned long long sum_y; |
| 34 | unsigned long long sum_x; |
| 35 | unsigned long long sum_x_sq; |
| 36 | unsigned long long sum_xy; |
| 37 | unsigned long long oldest_y; |
| 38 | |
| 39 | struct timeval prev_time; |
| 40 | unsigned long long prev_iops; |
| 41 | unsigned long long prev_bytes; |
| 42 | }; |
| 43 | |
| 44 | enum { |
| 45 | __FIO_SS_IOPS = 1, |
| 46 | __FIO_SS_BW = 2, |
| 47 | __FIO_SS_SLOPE = 4, |
| 48 | __FIO_SS_ATTAINED = 8, |
| 49 | __FIO_SS_RAMP_OVER = 16, |
| 50 | __FIO_SS_DATA = 32, |
| 51 | __FIO_SS_PCT = 64, |
| 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 |