Jens Axboe | 5995a6a | 2009-06-03 08:53:28 +0200 | [diff] [blame] | 1 | #ifndef FIO_IOLOG_H |
| 2 | #define FIO_IOLOG_H |
| 3 | |
| 4 | /* |
| 5 | * Use for maintaining statistics |
| 6 | */ |
| 7 | struct io_stat { |
| 8 | unsigned long max_val; |
| 9 | unsigned long min_val; |
| 10 | unsigned long samples; |
| 11 | |
| 12 | double mean; |
| 13 | double S; |
| 14 | }; |
| 15 | |
| 16 | /* |
| 17 | * A single data sample |
| 18 | */ |
| 19 | struct io_sample { |
| 20 | unsigned long time; |
| 21 | unsigned long val; |
| 22 | enum fio_ddir ddir; |
| 23 | unsigned int bs; |
| 24 | }; |
| 25 | |
| 26 | /* |
| 27 | * Dynamically growing data sample log |
| 28 | */ |
| 29 | struct io_log { |
| 30 | unsigned long nr_samples; |
| 31 | unsigned long max_samples; |
| 32 | struct io_sample *log; |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * When logging io actions, this matches a single sent io_u |
| 37 | */ |
| 38 | struct io_piece { |
| 39 | union { |
| 40 | struct rb_node rb_node; |
| 41 | struct flist_head list; |
| 42 | }; |
| 43 | union { |
| 44 | int fileno; |
| 45 | struct fio_file *file; |
| 46 | }; |
| 47 | unsigned long long offset; |
| 48 | unsigned long len; |
| 49 | enum fio_ddir ddir; |
| 50 | union { |
| 51 | unsigned long delay; |
| 52 | unsigned int file_action; |
| 53 | }; |
| 54 | }; |
| 55 | |
| 56 | /* |
| 57 | * Log exports |
| 58 | */ |
| 59 | enum file_log_act { |
| 60 | FIO_LOG_ADD_FILE, |
| 61 | FIO_LOG_OPEN_FILE, |
| 62 | FIO_LOG_CLOSE_FILE, |
| 63 | FIO_LOG_UNLINK_FILE, |
| 64 | }; |
| 65 | |
| 66 | extern int __must_check read_iolog_get(struct thread_data *, struct io_u *); |
| 67 | extern void log_io_u(struct thread_data *, struct io_u *); |
| 68 | extern void log_file(struct thread_data *, struct fio_file *, enum file_log_act); |
| 69 | extern int __must_check init_iolog(struct thread_data *td); |
| 70 | extern void log_io_piece(struct thread_data *, struct io_u *); |
| 71 | extern void queue_io_piece(struct thread_data *, struct io_piece *); |
| 72 | extern void prune_io_piece_log(struct thread_data *); |
| 73 | extern void write_iolog_close(struct thread_data *); |
| 74 | |
| 75 | /* |
| 76 | * Logging |
| 77 | */ |
| 78 | extern void add_clat_sample(struct thread_data *, enum fio_ddir, unsigned long, |
| 79 | unsigned int); |
| 80 | extern void add_slat_sample(struct thread_data *, enum fio_ddir, unsigned long, |
| 81 | unsigned int); |
| 82 | extern void add_bw_sample(struct thread_data *, enum fio_ddir, unsigned int, |
| 83 | struct timeval *); |
| 84 | extern void show_run_stats(void); |
| 85 | extern void init_disk_util(struct thread_data *); |
| 86 | extern void update_rusage_stat(struct thread_data *); |
| 87 | extern void update_io_ticks(void); |
| 88 | extern void setup_log(struct io_log **); |
| 89 | extern void finish_log(struct thread_data *, struct io_log *, const char *); |
| 90 | extern void finish_log_named(struct thread_data *, struct io_log *, const char *, const char *); |
| 91 | extern void __finish_log(struct io_log *, const char *); |
| 92 | extern struct io_log *agg_io_log[2]; |
| 93 | extern int write_bw_log; |
| 94 | extern void add_agg_sample(unsigned long, enum fio_ddir, unsigned int); |
| 95 | |
| 96 | #endif |