Skip to content

Commit 15b275c

Browse files
author
Jaegeuk Kim
committed
f2fs_io: measure a fsync latency
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 4fa0405 commit 15b275c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/f2fs_io/f2fs_io.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static u64 get_current_us()
160160
static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd)
161161
{
162162
int fd;
163+
u64 total_time;
163164

164165
if (argc != 2) {
165166
fputs("Excess arguments\n\n", stderr);
@@ -169,10 +170,12 @@ static void do_fsync(int argc, char **argv, const struct cmd_desc *cmd)
169170

170171
fd = xopen(argv[1], O_WRONLY, 0);
171172

173+
total_time = get_current_us();
172174
if (fsync(fd) != 0)
173175
die_errno("fsync failed");
174176

175-
printf("fsync a file\n");
177+
printf("fsync total_time = %"PRIu64" us\n",
178+
get_current_us() - total_time);
176179
exit(0);
177180
}
178181

0 commit comments

Comments
 (0)