steadystate: cleanups
[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
16e56d25
VF
6extern void steadystate_check(void);
7extern void steadystate_setup(void);
ba8fb6f6 8extern void steadystate_alloc(struct thread_data *);
4cd5b75b
JA
9
10extern bool steadystate;
0a70e050
JA
11
12/*
13 * For steady state detection
14 */
15struct steadystate_data {
16 double limit;
17 unsigned long long dur;
18 unsigned long long ramp_time;
0a70e050
JA
19 bool check_iops;
20 bool check_slope;
21 bool pct;
22
23 int attained;
24 int last_in_group;
25 int ramp_time_over;
26
27 unsigned int head;
28 unsigned int tail;
29 unsigned long *iops_data;
30 unsigned long *bw_data;
31
32 double slope;
33 double criterion;
34 double deviation;
35
36 unsigned long long sum_y;
37 unsigned long long sum_x;
38 unsigned long long sum_x_sq;
39 unsigned long long sum_xy;
40 unsigned long long oldest_y;
41
42 struct timeval prev_time;
43 unsigned long long prev_iops;
44 unsigned long long prev_bytes;
45};
46
4cd5b75b
JA
47enum {
48 FIO_STEADYSTATE_IOPS = 0,
49 FIO_STEADYSTATE_IOPS_SLOPE,
50 FIO_STEADYSTATE_BW,
51 FIO_STEADYSTATE_BW_SLOPE,
52};
53
54static inline bool steadystate_check_slope(struct thread_options *o)
55{
56 return o->ss == FIO_STEADYSTATE_IOPS_SLOPE ||
57 o->ss == FIO_STEADYSTATE_BW_SLOPE;
58}
59
60static inline bool steadystate_check_iops(struct thread_options *o)
61{
62 return o->ss == FIO_STEADYSTATE_IOPS ||
63 o->ss == FIO_STEADYSTATE_IOPS_SLOPE;
64}
65
16e56d25 66#endif