Report: fix performance comparision tables 08/12008/1
authorTibor Frank <tifrank@cisco.com>
Mon, 23 Apr 2018 11:41:51 +0000 (13:41 +0200)
committerTibor Frank <tifrank@cisco.com>
Mon, 23 Apr 2018 11:43:28 +0000 (13:43 +0200)
Change-Id: Ieae746412427980fb86512253cc58ebcee991317
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/tools/presentation/generator_tables.py
resources/tools/presentation/utils.py

index 9fe653c..a5a573a 100644 (file)
@@ -407,16 +407,22 @@ def table_performance_comparison(table, input_data):
             data_t = remove_outliers(tbl_dict[tst_name]["ref-data"],
                                      outlier_const=table["outlier-const"])
             # TODO: Specify window size.
-            item.append(round(mean(data_t) / 1000000, 2))
-            item.append(round(stdev(data_t) / 1000000, 2))
+            if data_t:
+                item.append(round(mean(data_t) / 1000000, 2))
+                item.append(round(stdev(data_t) / 1000000, 2))
+            else:
+                item.extend([None, None])
         else:
             item.extend([None, None])
         if tbl_dict[tst_name]["cmp-data"]:
             data_t = remove_outliers(tbl_dict[tst_name]["cmp-data"],
                                      outlier_const=table["outlier-const"])
             # TODO: Specify window size.
-            item.append(round(mean(data_t) / 1000000, 2))
-            item.append(round(stdev(data_t) / 1000000, 2))
+            if data_t:
+                item.append(round(mean(data_t) / 1000000, 2))
+                item.append(round(stdev(data_t) / 1000000, 2))
+            else:
+                item.extend([None, None])
         else:
             item.extend([None, None])
         if item[1] is not None and item[3] is not None:
@@ -598,16 +604,22 @@ def table_performance_comparison_mrr(table, input_data):
             data_t = remove_outliers(tbl_dict[tst_name]["ref-data"],
                                      outlier_const=table["outlier-const"])
             # TODO: Specify window size.
-            item.append(round(mean(data_t) / 1000000, 2))
-            item.append(round(stdev(data_t) / 1000000, 2))
+            if data_t:
+                item.append(round(mean(data_t) / 1000000, 2))
+                item.append(round(stdev(data_t) / 1000000, 2))
+            else:
+                item.extend([None, None])
         else:
             item.extend([None, None])
         if tbl_dict[tst_name]["cmp-data"]:
             data_t = remove_outliers(tbl_dict[tst_name]["cmp-data"],
                                      outlier_const=table["outlier-const"])
             # TODO: Specify window size.
-            item.append(round(mean(data_t) / 1000000, 2))
-            item.append(round(stdev(data_t) / 1000000, 2))
+            if data_t:
+                item.append(round(mean(data_t) / 1000000, 2))
+                item.append(round(stdev(data_t) / 1000000, 2))
+            else:
+                item.extend([None, None])
         else:
             item.extend([None, None])
         if item[1] is not None and item[3] is not None and item[1] != 0:
index 0e72a06..2fbf70c 100644 (file)
@@ -36,10 +36,7 @@ def mean(items):
     :rtype: float
     """
 
-    if len(items):
-        return float(sum(items)) / len(items)
-    else:
-        return None
+    return float(sum(items)) / len(items)
 
 
 def stdev(items):

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.