Prevent exception when no latency histogram
Change-Id: I1fb093610efc2e5bcb2c3ef192a12b1ce2ed8bdb
diff --git a/TestON/drivers/common/api/controller/trexclientdriver.py b/TestON/drivers/common/api/controller/trexclientdriver.py
index f6dfffe..de65f3a 100644
--- a/TestON/drivers/common/api/controller/trexclientdriver.py
+++ b/TestON/drivers/common/api/controller/trexclientdriver.py
@@ -568,7 +568,8 @@
# Assume whole the bucket experienced the range_end latency.
all_latencies += [range_end] * val
q = [50, 75, 90, 99, 99.9, 99.99, 99.999]
- percentiles = np.percentile(all_latencies, q)
+ # Prevent exception if we have no latency histogram
+ percentiles = np.percentile(all_latencies, q) if len(all_latencies) > 0 else [sys.maxint] * len(q)
ret = LatencyStats(
pg_id=pg_id,