lib/pattern: Support binary pattern buffers on windows
[fio.git] / engines / cmdprio.h
1 /*
2  * IO priority handling declarations and helper functions common to the
3  * libaio and io_uring engines.
4  */
5
6 #ifndef FIO_CMDPRIO_H
7 #define FIO_CMDPRIO_H
8
9 #include "../fio.h"
10
11 /* read and writes only, no trim */
12 #define CMDPRIO_RWDIR_CNT 2
13
14 enum {
15         CMDPRIO_MODE_NONE,
16         CMDPRIO_MODE_PERC,
17         CMDPRIO_MODE_BSSPLIT,
18 };
19
20 struct cmdprio_prio {
21         int32_t prio;
22         uint32_t perc;
23         uint16_t clat_prio_index;
24 };
25
26 struct cmdprio_bsprio {
27         uint64_t bs;
28         uint32_t tot_perc;
29         unsigned int nr_prios;
30         struct cmdprio_prio *prios;
31 };
32
33 struct cmdprio_bsprio_desc {
34         struct cmdprio_bsprio *bsprios;
35         unsigned int nr_bsprios;
36 };
37
38 struct cmdprio_options {
39         unsigned int percentage[CMDPRIO_RWDIR_CNT];
40         unsigned int class[CMDPRIO_RWDIR_CNT];
41         unsigned int level[CMDPRIO_RWDIR_CNT];
42         char *bssplit_str;
43 };
44
45 struct cmdprio {
46         struct cmdprio_options *options;
47         struct cmdprio_prio perc_entry[CMDPRIO_RWDIR_CNT];
48         struct cmdprio_bsprio_desc bsprio_desc[CMDPRIO_RWDIR_CNT];
49         unsigned int mode;
50 };
51
52 bool fio_cmdprio_set_ioprio(struct thread_data *td, struct cmdprio *cmdprio,
53                             struct io_u *io_u);
54
55 void fio_cmdprio_cleanup(struct cmdprio *cmdprio);
56
57 int fio_cmdprio_init(struct thread_data *td, struct cmdprio *cmdprio,
58                      struct cmdprio_options *options);
59
60 #endif