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