diff options
Diffstat (limited to 'resources/tools/presentation')
-rw-r--r-- | resources/tools/presentation/generator_tables.py | 12 | ||||
-rw-r--r-- | resources/tools/presentation/utils.py | 27 |
2 files changed, 36 insertions, 3 deletions
diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index acd3024f35..3bfae47d24 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -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 diff --git a/resources/tools/presentation/utils.py b/resources/tools/presentation/utils.py index c350fae135..8f5630083b 100644 --- a/resources/tools/presentation/utils.py +++ b/resources/tools/presentation/utils.py @@ -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. |