Report soak comparison: Add stdev for delta 19/19619/3
authorVratko Polak <vrpolak@cisco.com>
Wed, 15 May 2019 15:58:24 +0000 (17:58 +0200)
committerTibor Frank <tifrank@cisco.com>
Fri, 17 May 2019 06:50:13 +0000 (06:50 +0000)
Change-Id: Ibbff3c123afac2e68caf33f3ccd5fc4909509917
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/tools/presentation/generator_tables.py
resources/tools/presentation/utils.py

index acd3024..3bfae47 100644 (file)
@@ -551,7 +551,7 @@ def table_soak_vs_ndr(table, input_data):
             "{0} Stdev [Mpps]".format(table["reference"]["title"]),
             "{0} Throughput [Mpps]".format(table["compare"]["title"]),
             "{0} Stdev [Mpps]".format(table["compare"]["title"]),
-            "Delta [%]"]
+            "Delta [%]", "Stdev of delta [%]"]
         header_str = ",".join(header) + "\n"
     except (AttributeError, KeyError) as err:
         logging.error("The model is invalid, missing parameter: {0}".
@@ -612,7 +612,8 @@ def table_soak_vs_ndr(table, input_data):
         if data_r:
             data_r_mean = mean(data_r)
             item.append(round(data_r_mean / 1000000, 2))
-            item.append(round(stdev(data_r) / 1000000, 2))
+            data_r_stdev = stdev(data_r)
+            item.append(round(data_r_stdev / 1000000, 2))
         else:
             data_r_mean = None
             item.extend([None, None])
@@ -620,12 +621,17 @@ def table_soak_vs_ndr(table, input_data):
         if data_c:
             data_c_mean = mean(data_c)
             item.append(round(data_c_mean / 1000000, 2))
-            item.append(round(stdev(data_c) / 1000000, 2))
+            data_c_stdev = stdev(data_c)
+            item.append(round(data_c_stdev / 1000000, 2))
         else:
             data_c_mean = None
             item.extend([None, None])
         if data_r_mean and data_c_mean is not None:
             item.append(round(relative_change(data_r_mean, data_c_mean), 2))
+            delta, d_stdev = relative_change_stdev(
+                data_r_mean, data_c_mean, data_r_stdev, data_c_stdev)
+            item.append(round(delta, 2))
+            item.append(round(d_stdev, 2))
             tbl_lst.append(item)
 
     # Sort the table according to the relative change
index c350fae..8f56300 100644 (file)
@@ -16,6 +16,7 @@
 
 import multiprocessing
 import subprocess
+import math
 import numpy as np
 import logging
 import csv
@@ -68,6 +69,32 @@ def relative_change(nr1, nr2):
     return float(((nr2 - nr1) / nr1) * 100)
 
 
+def relative_change_stdev(mean1, mean2, std1, std2):
+    """Compute relative standard deviation of change of two values.
+
+    The "1" values are the base for comparison.
+    Results are returned as percentage (and percentual points for stdev).
+    Linearized theory is used, so results are wrong for relatively large stdev.
+
+    :param mean1: Mean of the first number.
+    :param mean2: Mean of the second number.
+    :param std1: Standard deviation estimate of the first number.
+    :param std2: Standard deviation estimate of the second number.
+    :type mean1: float
+    :type mean2: float
+    :type std1: float
+    :type std2: float
+    :returns: Relative change and its stdev.
+    :rtype: float
+    """
+    mean1, mean2 = float(mean1), float(mean2)
+    quotient = mean2 / mean1
+    first = std1 / mean1
+    second = std2 / mean2
+    std = quotient * math.sqrt(first * first + second * second)
+    return (quotient - 1) * 100, std * 100
+
+
 def get_files(path, extension=None, full_path=True):
     """Generates the list of files to process.
 

©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.