From e2db476f6e6710e418744247ab20e0667bf4d189 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Thu, 7 Sep 2023 10:38:06 -0700 Subject: [PATCH] virtio-devices: block: Correct the latency for the first op There is a "LATENCY_SCALE" being used for calculating cumulative average latency, so it should also be used for the latency of the first op. See: #5712 Signed-off-by: Bo Chen --- virtio-devices/src/block.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtio-devices/src/block.rs b/virtio-devices/src/block.rs index 9cc7d4bd3..f4a250338 100644 --- a/virtio-devices/src/block.rs +++ b/virtio-devices/src/block.rs @@ -307,7 +307,7 @@ impl BlockEpollHandler { // Special case the first real latency report read_avg = if read_avg == u64::MAX { - latency + latency * LATENCY_SCALE } else { read_avg + ((latency * LATENCY_SCALE) - read_avg) @@ -337,7 +337,7 @@ impl BlockEpollHandler { // Special case the first real latency report write_avg = if write_avg == u64::MAX { - latency + latency * LATENCY_SCALE } else { write_avg + ((latency * LATENCY_SCALE) - write_avg)