From 3d7c8c5942f76ac85e244ac83fb3c81e9d08db6f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 24 Nov 2005 16:21:49 +0100 Subject: [PATCH] [PATCH] fio: make disk util work better (account like ru) --- fio.c | 10 +++++----- fio.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fio.c b/fio.c index a789bd8..76e3626 100644 --- a/fio.c +++ b/fio.c @@ -1579,12 +1579,13 @@ static int get_io_ticks(struct thread_data *td) return i8; } -static void finish_disk_stats(struct thread_data *td) +static void update_io_ticks(struct thread_data *td) { unsigned long ticks; ticks = get_io_ticks(td); - td->io_ticks = ticks - td->io_ticks; + td->io_ticks += (ticks - td->start_io_ticks); + td->start_io_ticks = ticks; } static int init_disk_stats(struct thread_data *td) @@ -1623,7 +1624,7 @@ static int init_disk_stats(struct thread_data *td) sprintf(td->disk_stat_path, "%s/stat", p); } - td->io_ticks = get_io_ticks(td); + td->start_io_ticks = get_io_ticks(td); return 0; } @@ -1715,6 +1716,7 @@ static void *thread_main(void *data) td->runtime += mtime_since_now(&td->start); update_rusage_stat(td); + update_io_ticks(td); if (td->verify == VERIFY_NONE) continue; @@ -1732,8 +1734,6 @@ static void *thread_main(void *data) ret = 0; - finish_disk_stats(td); - if (td->bw_log) finish_log(td, td->bw_log, "bw"); if (td->lat_log) diff --git a/fio.h b/fio.h index 1ef9d33..54a23a3 100644 --- a/fio.h +++ b/fio.h @@ -172,7 +172,7 @@ struct thread_data { * disk util stats */ char disk_stat_path[256]; - unsigned long io_ticks; + unsigned long start_io_ticks, io_ticks; }; extern int parse_jobs_ini(char *); -- 2.25.1