target: fixes
[fio.git] / target.h
CommitLineData
1a7081c7
JA
1#ifndef FIO_LAT_TARGET_H
2#define FIO_LAT_TARGET_H
3
4#include "fio.h"
5
6enum {
7 IOD_STEPPED_DEF_RAMP = 5000,
8 IOD_STEPPED_DEF_RUN = 30000,
9};
10
11/*
12 * Starts out as PROBE_RAMP -> PROBE_RUN, then iterations of
13 * RAMP -> RUN with various iops limiting settings
14 */
15enum {
16 IOD_STATE_PROBE_RAMP = 1,
17 IOD_STATE_PROBE_RUN,
18 IOD_STATE_RAMP,
19 IOD_STATE_RUN,
20 IOD_STATE_DONE,
21};
22
23/*
24 * Latency target helpers
25 */
26void lat_target_init(struct thread_data *);
27void lat_target_reset(struct thread_data *);
28bool lat_target_failed(struct thread_data *td);
29void lat_step_report(struct thread_stat *ts, struct buf_output *out);
30bool lat_ts_has_stats(struct thread_stat *ts);
31bool __lat_ts_has_stats(struct thread_stat *ts, enum fio_ddir);
32
33void lat_fatal(struct thread_data *td, unsigned long long tnsec,
34 unsigned long long max_nsec);
35
36bool lat_step_check(struct thread_data *td);
37void __lat_target_check(struct thread_data *td);
38
39static inline bool lat_target_check(struct thread_data *td)
40{
41 if (td->o.latency_target) {
42 __lat_target_check(td);
43 return false;
44 } else if (td->o.iodepth_mode == IOD_STEPPED)
45 return lat_step_check(td);
46
47 return false;
48}
49
50static inline bool lat_step_account(struct thread_data *td)
51{
52 if (td->o.iodepth_mode != IOD_STEPPED)
53 return true;
54
55 return td->latency_state == IOD_STATE_RUN;
56}
57
58#endif