From: Jens Axboe Date: Thu, 25 Jan 2018 16:27:14 +0000 (-0700) Subject: Track fsync/fdatasync/sync_file_range issue count X-Git-Tag: fio-3.4~16 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=7f3ecee2f6dd2aa40c0404a40d0406d9efc765f2 Track fsync/fdatasync/sync_file_range issue count Also fix an issue where we didn't initialize the sync minimum latency correctly, so it was always reported as 0. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index 8a801383..ae3c4f74 100644 --- a/init.c +++ b/init.c @@ -1481,6 +1481,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, td->ts.bw_stat[i].min_val = ULONG_MAX; td->ts.iops_stat[i].min_val = ULONG_MAX; } + td->ts.sync_stat.min_val = ULONG_MAX; td->ddir_seq_nr = o->ddir_seq_nr; if ((o->stonewall || o->new_group) && prev_group_jobs) { diff --git a/io_ddir.h b/io_ddir.h index 613d5fbc..71084aa4 100644 --- a/io_ddir.h +++ b/io_ddir.h @@ -5,8 +5,11 @@ enum fio_ddir { DDIR_READ = 0, DDIR_WRITE = 1, DDIR_TRIM = 2, - DDIR_RWDIR_CNT = 3, DDIR_SYNC = 3, + + DDIR_RWDIR_CNT = 3, + DDIR_RWDIR_SYNC_CNT = 4, + DDIR_DATASYNC, DDIR_SYNC_FILE_RANGE, DDIR_WAIT, diff --git a/ioengines.c b/ioengines.c index fb475e97..5dd2311a 100644 --- a/ioengines.c +++ b/ioengines.c @@ -357,7 +357,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) } if (ret == FIO_Q_COMPLETED) { - if (ddir_rw(io_u->ddir)) { + if (ddir_rw(io_u->ddir) || ddir_sync(io_u->ddir)) { io_u_mark_depth(td, 1); td->ts.total_io_u[io_u->ddir]++; } @@ -366,7 +366,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u) td->io_u_queued++; - if (ddir_rw(io_u->ddir)) + if (ddir_rw(io_u->ddir) || ddir_sync(io_u->ddir)) td->ts.total_io_u[io_u->ddir]++; if (td->io_u_queued >= td->o.iodepth_batch) { diff --git a/stat.c b/stat.c index 3a014d6c..36e06457 100644 --- a/stat.c +++ b/stat.c @@ -854,12 +854,13 @@ static void show_thread_status_normal(struct thread_stat *ts, io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]); - log_buf(out, " issued rwt: total=%llu,%llu,%llu," - " short=%llu,%llu,%llu," - " dropped=%llu,%llu,%llu\n", + log_buf(out, " issued rwts: total=%llu,%llu,%llu,%llu" + " short=%llu,%llu,%llu,0" + " dropped=%llu,%llu,%llu,0\n", (unsigned long long) ts->total_io_u[0], (unsigned long long) ts->total_io_u[1], (unsigned long long) ts->total_io_u[2], + (unsigned long long) ts->total_io_u[3], (unsigned long long) ts->short_io_u[0], (unsigned long long) ts->short_io_u[1], (unsigned long long) ts->short_io_u[2], @@ -1609,6 +1610,8 @@ void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src, } } + dst->total_io_u[DDIR_SYNC] += src->total_io_u[DDIR_SYNC]; + for (k = 0; k < DDIR_RWDIR_CNT; k++) { int m; @@ -1647,6 +1650,7 @@ void init_thread_stat(struct thread_stat *ts) ts->bw_stat[j].min_val = -1UL; ts->iops_stat[j].min_val = -1UL; } + ts->sync_stat.min_val = -1UL; ts->groupid = -1; } @@ -2287,6 +2291,8 @@ void reset_io_stats(struct thread_data *td) } } + ts->total_io_u[DDIR_SYNC] = 0; + for (i = 0; i < FIO_IO_U_MAP_NR; i++) { ts->io_u_map[i] = 0; ts->io_u_submit[i] = 0; diff --git a/stat.h b/stat.h index e32a21ec..fd5131f9 100644 --- a/stat.h +++ b/stat.h @@ -192,7 +192,7 @@ struct thread_stat { uint32_t io_u_sync_plat[FIO_IO_U_PLAT_NR]; uint32_t pad; - uint64_t total_io_u[DDIR_RWDIR_CNT]; + uint64_t total_io_u[DDIR_RWDIR_SYNC_CNT]; uint64_t short_io_u[DDIR_RWDIR_CNT]; uint64_t drop_io_u[DDIR_RWDIR_CNT]; uint64_t total_submit;