From d4af2ecea2930138bbaf58fe84debef8e84761c6 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 9 Oct 2021 12:56:11 -0600 Subject: [PATCH] t/io_uring: fix latency stats for depth == 1 Two issues here: - Stat increment accounting was off-by-one, causing no stats added for depth == 1 - The stat batch count should be a minimum of 2, since it's really a mask. Signed-off-by: Jens Axboe --- t/io_uring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t/io_uring.c b/t/io_uring.c index 2c9fd08c..cdd15986 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -531,8 +531,8 @@ static int reap_events_uring(struct submitter *s) stat_nr = 0; } last_idx = clock_index; - } else if (clock_index) - stat_nr++; + } + stat_nr++; } reaped++; head++; @@ -562,6 +562,8 @@ static int submitter_init(struct submitter *s) if (stats) { nr_batch = roundup_pow2(depth / batch_submit); + if (nr_batch < 2) + nr_batch = 2; s->clock_batch = calloc(nr_batch, sizeof(unsigned long)); s->clock_index = 1; @@ -637,8 +639,8 @@ static int reap_events_aio(struct submitter *s, struct io_event *events, int evs stat_nr = 0; } last_idx = clock_index; - } else if (clock_index) - stat_nr++; + } + stat_nr++; } reaped++; evs--; -- 2.25.1