Merge branch 'parse-and-fill-pattern' of https://github.com/bvanassche/fio
[fio.git] / steadystate.h
CommitLineData
16e56d25
VF
1#ifndef FIO_STEADYSTATE_H
2#define FIO_STEADYSTATE_H
3
4cd5b75b
JA
4#include "thread_options.h"
5
c27cc65f 6extern void steadystate_free(struct thread_data *);
16e56d25
VF
7extern void steadystate_check(void);
8extern void steadystate_setup(void);
56a90eba 9extern int td_steadystate_init(struct thread_data *);
9d193019
VF
10extern uint64_t steadystate_bw_mean(struct thread_stat *);
11extern uint64_t steadystate_iops_mean(struct thread_stat *);
4cd5b75b 12
84784e07 13extern bool steadystate_enabled;
0a70e050 14
0a70e050
JA
15struct steadystate_data {
16 double limit;
17 unsigned long long dur;
18 unsigned long long ramp_time;
0a70e050 19
bb49c8bd 20 uint32_t state;
0a70e050
JA
21
22 unsigned int head;
23 unsigned int tail;
bb49c8bd
VF
24 uint64_t *iops_data;
25 uint64_t *bw_data;
0a70e050
JA
26
27 double slope;
0a70e050 28 double deviation;
bb49c8bd 29 double criterion;
0a70e050 30
9d193019
VF
31 uint64_t sum_y;
32 uint64_t sum_x;
33 uint64_t sum_x_sq;
34 uint64_t sum_xy;
35 uint64_t oldest_y;
0a70e050 36
8b6a404c 37 struct timespec prev_time;
9d193019
VF
38 uint64_t prev_iops;
39 uint64_t prev_bytes;
0a70e050
JA
40};
41
4cd5b75b 42enum {
c8caba48
JA
43 __FIO_SS_IOPS = 0,
44 __FIO_SS_BW,
45 __FIO_SS_SLOPE,
46 __FIO_SS_ATTAINED,
47 __FIO_SS_RAMP_OVER,
48 __FIO_SS_DATA,
49 __FIO_SS_PCT,
50 __FIO_SS_BUFFER_FULL,
51};
52
53enum {
54 FIO_SS_IOPS = 1 << __FIO_SS_IOPS,
55 FIO_SS_BW = 1 << __FIO_SS_BW,
56 FIO_SS_SLOPE = 1 << __FIO_SS_SLOPE,
57 FIO_SS_ATTAINED = 1 << __FIO_SS_ATTAINED,
58 FIO_SS_RAMP_OVER = 1 << __FIO_SS_RAMP_OVER,
59 FIO_SS_DATA = 1 << __FIO_SS_DATA,
60 FIO_SS_PCT = 1 << __FIO_SS_PCT,
61 FIO_SS_BUFFER_FULL = 1 << __FIO_SS_BUFFER_FULL,
62
63 FIO_SS_IOPS_SLOPE = FIO_SS_IOPS | FIO_SS_SLOPE,
64 FIO_SS_BW_SLOPE = FIO_SS_BW | FIO_SS_SLOPE,
4cd5b75b
JA
65};
66
84784e07
JA
67#define STEADYSTATE_MSEC 1000
68
16e56d25 69#endif