fix(jumpavg): Tolerate zero sized runs 30/40230/2
authorVratko Polak <vrpolak@cisco.com>
Mon, 22 Jan 2024 16:58:22 +0000 (17:58 +0100)
committerVratko Polak <vrpolak@cisco.com>
Mon, 22 Jan 2024 16:58:22 +0000 (17:58 +0100)
Change-Id: I7c2426fe47ca9ee44338423597be90a71aaa3653
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/libraries/python/jumpavg/avg_stdev_stats.py

index 3d6a834..c21c50c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -73,6 +73,8 @@ class AvgStdevStats:
                 run_size = run.size
                 run_avg = run.avg
                 run_stdev = run.stdev
+            if run_size < 1:
+                continue
             old_total_size = total_size
             delta = run_avg - total_avg
             total_size += run_size