From 71cb78c10a80f448b912dc20d24ea731f6a102d9 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Sun, 16 Apr 2017 15:04:26 -0400 Subject: [PATCH 1/1] stat: reset_io_stats: fix a problem, rearrange some code 1) Make sure all the io_u_lat_u/m are reset 2) Only need to zero out total_submit/complete once 3) Reset total/short/drop_io_u inside the other loop that iterates over data directions Signed-off-by: Jens Axboe --- stat.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/stat.c b/stat.c index 8770ae28..6e47c34c 100644 --- a/stat.c +++ b/stat.c @@ -2171,6 +2171,9 @@ void reset_io_stats(struct thread_data *td) ts->io_bytes[i] = 0; ts->runtime[i] = 0; + ts->total_io_u[i] = 0; + ts->short_io_u[i] = 0; + ts->drop_io_u[i] = 0; for (j = 0; j < FIO_IO_U_PLAT_NR; j++) ts->io_u_plat[i][j] = 0; @@ -2180,17 +2183,15 @@ void reset_io_stats(struct thread_data *td) ts->io_u_map[i] = 0; ts->io_u_submit[i] = 0; ts->io_u_complete[i] = 0; + } + + for (i = 0; i < FIO_IO_U_LAT_U_NR; i++) ts->io_u_lat_u[i] = 0; + for (i = 0; i < FIO_IO_U_LAT_M_NR; i++) ts->io_u_lat_m[i] = 0; - ts->total_submit = 0; - ts->total_complete = 0; - } - for (i = 0; i < 3; i++) { - ts->total_io_u[i] = 0; - ts->short_io_u[i] = 0; - ts->drop_io_u[i] = 0; - } + ts->total_submit = 0; + ts->total_complete = 0; } static void __add_stat_to_log(struct io_log *iolog, enum fio_ddir ddir, -- 2.25.1