X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_plots.py;h=52348fe5d15c39ba16c70fb7c0e3c3235ebca2f0;hp=aaee31f53be664e001b7de1e2cfd1efe62cd7db3;hb=eb5271b56cb94711420a1eb7372b0f4d5f275a40;hpb=be3c126b04b89c1cacdfda2d82bad6e002d5135d diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py index aaee31f53b..52348fe5d1 100644 --- a/resources/tools/presentation/generator_plots.py +++ b/resources/tools/presentation/generator_plots.py @@ -59,8 +59,9 @@ def plot_performance_box(plot, input_data): format(plot.get("title", ""))) # Transform the data + plot_title = plot.get("title", "") logging.info(" Creating the data set for the {0} '{1}'.". - format(plot.get("type", ""), plot.get("title", ""))) + format(plot.get("type", ""), plot_title)) data = input_data.filter_data(plot) if data is None: logging.error("No data.") @@ -74,7 +75,21 @@ def plot_performance_box(plot, input_data): if y_vals.get(test["parent"], None) is None: y_vals[test["parent"]] = list() try: - y_vals[test["parent"]].append(test["throughput"]["value"]) + # TODO: Remove when definitely no NDRPDRDISC tests are used: + if test["type"] in ("NDR", "PDR"): + y_vals[test["parent"]].\ + append(test["throughput"]["value"]) + elif test["type"] in ("NDRPDR", ): + if "-pdr" in plot_title.lower(): + y_vals[test["parent"]].\ + append(test["throughput"]["PDR"]["LOWER"]) + elif "-ndr" in plot_title.lower(): + y_vals[test["parent"]]. \ + append(test["throughput"]["NDR"]["LOWER"]) + else: + continue + else: + continue except (KeyError, TypeError): y_vals[test["parent"]].append(None) @@ -92,7 +107,8 @@ def plot_performance_box(plot, input_data): df = pd.DataFrame(y_vals) df.head() for i, col in enumerate(df.columns): - name = "{0}. {1}".format(i + 1, col.lower().replace('-ndrpdrdisc', '')) + name = "{0}. {1}".format(i + 1, col.lower().replace('-ndrpdrdisc', ''). + replace('-ndrpdr', '')) traces.append(plgo.Box(x=[str(i + 1) + '.'] * len(df[col]), y=df[col], name=name, @@ -131,8 +147,9 @@ def plot_latency_box(plot, input_data): format(plot.get("title", ""))) # Transform the data + plot_title = plot.get("title", "") logging.info(" Creating the data set for the {0} '{1}'.". - format(plot.get("type", ""), plot.get("title", ""))) + format(plot.get("type", ""), plot_title)) data = input_data.filter_data(plot) if data is None: logging.error("No data.") @@ -153,18 +170,41 @@ def plot_latency_box(plot, input_data): list() # direction2, max ] try: - y_tmp_vals[test["parent"]][0].append( - test["latency"]["direction1"]["50"]["min"]) - y_tmp_vals[test["parent"]][1].append( - test["latency"]["direction1"]["50"]["avg"]) - y_tmp_vals[test["parent"]][2].append( - test["latency"]["direction1"]["50"]["max"]) - y_tmp_vals[test["parent"]][3].append( - test["latency"]["direction2"]["50"]["min"]) - y_tmp_vals[test["parent"]][4].append( - test["latency"]["direction2"]["50"]["avg"]) - y_tmp_vals[test["parent"]][5].append( - test["latency"]["direction2"]["50"]["max"]) + # TODO: Remove when definitely no NDRPDRDISC tests are used: + if test["type"] in ("NDR", "PDR"): + y_tmp_vals[test["parent"]][0].append( + test["latency"]["direction1"]["50"]["min"]) + y_tmp_vals[test["parent"]][1].append( + test["latency"]["direction1"]["50"]["avg"]) + y_tmp_vals[test["parent"]][2].append( + test["latency"]["direction1"]["50"]["max"]) + y_tmp_vals[test["parent"]][3].append( + test["latency"]["direction2"]["50"]["min"]) + y_tmp_vals[test["parent"]][4].append( + test["latency"]["direction2"]["50"]["avg"]) + y_tmp_vals[test["parent"]][5].append( + test["latency"]["direction2"]["50"]["max"]) + elif test["type"] in ("NDRPDR", ): + if "-pdr" in plot_title.lower(): + ttype = "PDR" + elif "-ndr" in plot_title.lower(): + ttype = "NDR" + else: + continue + y_tmp_vals[test["parent"]][0].append( + test["latency"][ttype]["direction1"]["min"]) + y_tmp_vals[test["parent"]][1].append( + test["latency"][ttype]["direction1"]["avg"]) + y_tmp_vals[test["parent"]][2].append( + test["latency"][ttype]["direction1"]["max"]) + y_tmp_vals[test["parent"]][3].append( + test["latency"][ttype]["direction2"]["min"]) + y_tmp_vals[test["parent"]][4].append( + test["latency"][ttype]["direction2"]["avg"]) + y_tmp_vals[test["parent"]][5].append( + test["latency"][ttype]["direction2"]["max"]) + else: + continue except (KeyError, TypeError): pass @@ -190,7 +230,8 @@ def plot_latency_box(plot, input_data): return for i, col in enumerate(df.columns): - name = "{0}. {1}".format(i + 1, col.lower().replace('-ndrpdrdisc', '')) + name = "{0}. {1}".format(i + 1, col.lower().replace('-ndrpdrdisc', ''). + replace('-ndrpdr', '')) traces.append(plgo.Box(x=['TGint1-to-SUT1-to-SUT2-to-TGint2', 'TGint1-to-SUT1-to-SUT2-to-TGint2', 'TGint1-to-SUT1-to-SUT2-to-TGint2', @@ -240,8 +281,9 @@ def plot_throughput_speedup_analysis(plot, input_data): format(plot.get("title", ""))) # Transform the data + plot_title = plot.get("title", "") logging.info(" Creating the data set for the {0} '{1}'.". - format(plot.get("type", ""), plot.get("title", ""))) + format(plot.get("type", ""), plot_title)) data = input_data.filter_data(plot) if data is None: logging.error("No data.") @@ -256,15 +298,33 @@ def plot_throughput_speedup_analysis(plot, input_data): "2": list(), "4": list()} try: - if "1T1C" in test["tags"]: - throughput[test["parent"]]["1"].\ - append(test["throughput"]["value"]) - elif "2T2C" in test["tags"]: - throughput[test["parent"]]["2"]. \ - append(test["throughput"]["value"]) - elif "4T4C" in test["tags"]: - throughput[test["parent"]]["4"]. \ - append(test["throughput"]["value"]) + # TODO: Remove when definitely no NDRPDRDISC tests are used: + if test["type"] in ("NDR", "PDR"): + if "1T1C" in test["tags"]: + throughput[test["parent"]]["1"].\ + append(test["throughput"]["value"]) + elif "2T2C" in test["tags"]: + throughput[test["parent"]]["2"]. \ + append(test["throughput"]["value"]) + elif "4T4C" in test["tags"]: + throughput[test["parent"]]["4"]. \ + append(test["throughput"]["value"]) + elif test["type"] in ("NDRPDR", ): + if "-pdr" in plot_title.lower(): + ttype = "PDR" + elif "-ndr" in plot_title.lower(): + ttype = "NDR" + else: + continue + if "1T1C" in test["tags"]: + throughput[test["parent"]]["1"].\ + append(test["throughput"][ttype]["LOWER"]) + elif "2T2C" in test["tags"]: + throughput[test["parent"]]["2"]. \ + append(test["throughput"][ttype]["LOWER"]) + elif "4T4C" in test["tags"]: + throughput[test["parent"]]["4"]. \ + append(test["throughput"][ttype]["LOWER"]) except (KeyError, TypeError): pass @@ -356,7 +416,7 @@ def plot_http_server_performance_box(plot, input_data): if y_vals.get(test["name"], None) is None: y_vals[test["name"]] = list() try: - y_vals[test["name"]].append(test["result"]["value"]) + y_vals[test["name"]].append(test["result"]) except (KeyError, TypeError): y_vals[test["name"]].append(None)