| 1 | #ifndef FIO_RATE_H |
| 2 | #define FIO_RATE_H |
| 3 | |
| 4 | #include "flist.h" |
| 5 | |
| 6 | typedef void (workqueue_fn)(struct thread_data *, struct io_u *); |
| 7 | |
| 8 | struct workqueue { |
| 9 | unsigned int max_workers; |
| 10 | |
| 11 | struct thread_data *td; |
| 12 | workqueue_fn *fn; |
| 13 | |
| 14 | uint64_t work_seq; |
| 15 | struct submit_worker *workers; |
| 16 | unsigned int next_free_worker; |
| 17 | |
| 18 | pthread_cond_t flush_cond; |
| 19 | pthread_mutex_t flush_lock; |
| 20 | pthread_mutex_t stat_lock; |
| 21 | volatile int wake_idle; |
| 22 | }; |
| 23 | |
| 24 | int workqueue_init(struct thread_data *td, struct workqueue *wq, workqueue_fn *fn, unsigned int max_workers); |
| 25 | void workqueue_exit(struct workqueue *wq); |
| 26 | |
| 27 | int workqueue_enqueue(struct workqueue *wq, struct io_u *io_u); |
| 28 | void workqueue_flush(struct workqueue *wq); |
| 29 | |
| 30 | #endif |