f2fs_io: measure the start time explicitly Let's measure the start time more precisely. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c index 326b3bd..bc2e014 100644 --- a/tools/f2fs_io/f2fs_io.c +++ b/tools/f2fs_io/f2fs_io.c
@@ -1009,8 +1009,8 @@ printf("fadvise SEQUENTIAL|WILLNEED to a file: %s\n", argv[7]); } - io_time_start = get_current_us(); if (do_mmap) { + io_time_start = get_current_us(); data = mmap(NULL, count * buf_size, PROT_READ, MAP_SHARED | MAP_POPULATE, fd, offset); if (data == MAP_FAILED) @@ -1028,6 +1028,8 @@ MAP_SHARED, fd, offset); if (data == MAP_FAILED) die("Mmap failed"); + + io_time_start = get_current_us(); if (posix_fadvise(fd, offset, count * buf_size, POSIX_FADV_WILLNEED) != 0) die_errno("fadvise failed"); @@ -1040,6 +1042,7 @@ read_cnt = count * buf_size; memcpy(print_buf, data, print_bytes); } else { + io_time_start = get_current_us(); for (i = 0; i < count; i++) { if (!do_dontcache) { ret = pread(fd, buf, buf_size, offset + buf_size * i);