t/latency_percentiles: avoid division by zero
[fio.git] / t / latency_percentiles.py
index 0c8d0c194aa3a94c78664ba3e2455f68fdcc327d..5cdd49cf77bcb2fcde6d7b82b3f5966768fa04af 100755 (executable)
@@ -395,6 +395,11 @@ class FioLatTest():
         approximation   value of the bin used by fio to store a given latency
         actual          actual latency value
         """
+
+        # Avoid a division by zero. The smallest latency values have no error.
+        if actual == 0:
+            return approximation == 0
+
         delta = abs(approximation - actual) / actual
         return delta <= 1/128