From f3b8306b3436ed0537558ddb7340534f9e2c42ef Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 26 May 2025 10:31:00 -0400 Subject: bench/ioq: Don't track the latency of failed requests This fixes a hang observed with low queue depths like -d32. --- bench/ioq.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'bench/ioq.c') diff --git a/bench/ioq.c b/bench/ioq.c index 61c9714..aca97dd 100644 --- a/bench/ioq.c +++ b/bench/ioq.c @@ -63,14 +63,8 @@ static void times_init(struct times *times) { gettime(×->start); } -/** Start timing a single request. */ -static void start_request(struct times *times) { - gettime(×->req_start); - times->timing = true; -} - /** Finish timing a request. */ -static void finish_request(struct times *times) { +static void track_latency(struct times *times) { struct timespec elapsed; gettime(&elapsed); timespec_sub(&elapsed, ×->req_start); @@ -127,8 +121,8 @@ static bool push(struct ioq *ioq, enum ioq_nop_type type, struct times *lap) { // Track latency for a small fraction of requests if (!lap->timing && (lap->pushed + 1) % 128 == 0) { - start_request(lap); ptr = lap; + gettime(&lap->req_start); } int ret = ioq_nop(ioq, type, ptr); @@ -138,6 +132,9 @@ static bool push(struct ioq *ioq, enum ioq_nop_type type, struct times *lap) { } ++lap->pushed; + if (ptr) { + lap->timing = true; + } return true; } @@ -149,7 +146,7 @@ static bool pop(struct ioq *ioq, struct times *lap, bool block) { } if (ent->ptr) { - finish_request(lap); + track_latency(lap); } ioq_free(ioq, ent); -- cgit v1.2.3