From: Jens Axboe Date: Mon, 4 Oct 2021 22:35:15 +0000 (-0600) Subject: t/io_uring: check for valid clock_index and finish state for stats X-Git-Tag: fio-3.29~76 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=265697fc16b767fee5fae25a73d74ec4df20d94a;p=fio.git t/io_uring: check for valid clock_index and finish state for stats If the clock_index isn't non-zero, it's not valid and we should disregard the sample. Ditto if an exit signal has been sent, we're done at that point and aren't interested in the last samples. Signed-off-by: Jens Axboe --- diff --git a/t/io_uring.c b/t/io_uring.c index 2ae65bc1..ffdb5d3d 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -309,10 +309,12 @@ static void add_stat(struct submitter *s, int clock_index, int nr) unsigned long cycles; unsigned int pidx; - cycles = get_cpu_clock(); - cycles -= s->clock_batch[clock_index]; - pidx = plat_val_to_idx(cycles); - s->plat[pidx] += nr; + if (!s->finish && clock_index) { + cycles = get_cpu_clock(); + cycles -= s->clock_batch[clock_index]; + pidx = plat_val_to_idx(cycles); + s->plat[pidx] += nr; + } #endif }