X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=diskutil.h;h=15ec681a449c4a9b34929933ab95f1c85b3c1257;hp=ff8a5b065f5d8b9914a4160df53218cdab3d8e80;hb=refs%2Fheads%2Fmaster;hpb=ecfd2bb08cc87bc9a1b3d612258f1fdfb4d09698 diff --git a/diskutil.h b/diskutil.h index ff8a5b06..9b283799 100644 --- a/diskutil.h +++ b/diskutil.h @@ -1,11 +1,25 @@ #ifndef FIO_DISKUTIL_H #define FIO_DISKUTIL_H -#include "json.h" #define FIO_DU_NAME_SZ 64 -#include "lib/output_buffer.h" -#include "helper_thread.h" +#include +#include +#include "helper_thread.h" +#include "fio_sem.h" +#include "flist.h" +#include "lib/ieee754.h" + +/** + * @ios: Number of I/O operations that have been completed successfully. + * @merges: Number of I/O operations that have been merged. + * @sectors: I/O size in 512-byte units. + * @ticks: Time spent on I/O in milliseconds. + * @io_ticks: CPU time spent on I/O in milliseconds. + * @time_in_queue: Weighted time spent doing I/O in milliseconds. + * + * For the array members, index 0 refers to reads and index 1 refers to writes. + */ struct disk_util_stats { uint64_t ios[2]; uint64_t merges[2]; @@ -17,7 +31,7 @@ struct disk_util_stats { }; /* - * Disk utils as read in /sys/block//stat + * Disk utilization as read from /sys/block//stat */ struct disk_util_stat { uint8_t name[FIO_DU_NAME_SZ]; @@ -46,7 +60,6 @@ struct disk_util { */ struct flist_head slavelist; - char *name; char *sysfs_root; char path[PATH_MAX]; int major, minor; @@ -65,9 +78,9 @@ struct disk_util { */ struct flist_head slaves; - struct timeval time; + struct timespec time; - struct fio_mutex *lock; + struct fio_sem *lock; unsigned long users; }; @@ -76,7 +89,7 @@ static inline void disk_util_mod(struct disk_util *du, int val) if (du) { struct flist_head *n; - fio_mutex_down(du->lock); + fio_sem_down(du->lock); du->users += val; flist_for_each(n, &du->slavelist) { @@ -85,7 +98,7 @@ static inline void disk_util_mod(struct disk_util *du, int val) slave = flist_entry(n, struct disk_util, slavelist); slave->users += val; } - fio_mutex_up(du->lock); + fio_sem_up(du->lock); } } static inline void disk_util_inc(struct disk_util *du) @@ -106,25 +119,15 @@ extern struct flist_head disk_list; * disk util stuff */ #ifdef FIO_HAVE_DISK_UTIL -extern void print_disk_util(struct disk_util_stat *, struct disk_util_agg *, int terse, struct buf_output *); -extern void show_disk_util(int terse, struct json_object *parent, struct buf_output *); -extern void json_array_add_disk_util(struct disk_util_stat *dus, - struct disk_util_agg *agg, struct json_array *parent); extern void init_disk_util(struct thread_data *); extern int update_io_ticks(void); extern void setup_disk_util(void); extern void disk_util_prune_entries(void); #else -static inline void print_disk_util(struct disk_util_stat *du, - struct disk_util_agg *agg, int terse, - struct buf_output *out) -{ -} -#define show_disk_util(terse, parent, out) +/* keep this as a function to avoid a warning in handle_du() */ #define disk_util_prune_entries() #define init_disk_util(td) #define setup_disk_util() -#define json_array_add_disk_util(dus, agg, parent) static inline int update_io_ticks(void) {