X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_plots.py;h=f03a57f2794f2c6f291fce0e7fe75ab628f08b38;hb=149b1109affae3e54157e3c38db97f376d27328b;hp=39b6f9bea49e48cbf3f1e3813762ffc0239f50b5;hpb=ed54e298a1b7796e37c1d1f4e0642595177949bd;p=csit.git
diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py
index 39b6f9bea4..f03a57f279 100644
--- a/resources/tools/presentation/generator_plots.py
+++ b/resources/tools/presentation/generator_plots.py
@@ -18,16 +18,16 @@
import re
import logging
+from collections import OrderedDict
+from copy import deepcopy
+from math import log
+
import hdrh.histogram
import hdrh.codec
import pandas as pd
import plotly.offline as ploff
import plotly.graph_objs as plgo
-from collections import OrderedDict
-from copy import deepcopy
-from math import log
-
from plotly.exceptions import PlotlyError
from pal_utils import mean, stdev
@@ -200,7 +200,8 @@ def plot_hdrh_lat_by_percentile(plot, input_data):
hovertext.append(
f"{desc[graph]}
"
f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
- f"Percentile: {previous_x:.5f}-{percentile:.5f}%
"
+ f"Percentile: "
+ f"{previous_x:.5f}-{percentile:.5f}%
"
f"Latency: {item.value_iterated_to}uSec"
)
xaxis.append(percentile)
@@ -208,7 +209,8 @@ def plot_hdrh_lat_by_percentile(plot, input_data):
hovertext.append(
f"{desc[graph]}
"
f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
- f"Percentile: {previous_x:.5f}-{percentile:.5f}%
"
+ f"Percentile: "
+ f"{previous_x:.5f}-{percentile:.5f}%
"
f"Latency: {item.value_iterated_to}uSec"
)
previous_x = percentile
@@ -351,7 +353,7 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
decoded = hdrh.histogram.HdrHistogram.decode(
test[u"latency"][graph][direction][u"hdrh"]
)
- except hdrh.codec.HdrLengthException:
+ except (hdrh.codec.HdrLengthException, TypeError):
logging.warning(
f"No data for direction {(u'W-E', u'E-W')[idx % 2]}"
)
@@ -604,6 +606,19 @@ def plot_perf_box_name(plot, input_data):
)
test_type = u"HOSTSTACK"
+ elif test[u"type"] in (u"LDP_NGINX",):
+ if u"TCP_CPS" in test[u"tags"]:
+ test_type = u"VSAP_CPS"
+ y_vals[test[u"parent"]].append(
+ test[u"result"][u"cps"]
+ )
+ elif u"TCP_RPS" in test[u"tags"]:
+ test_type = u"VSAP_RPS"
+ y_vals[test[u"parent"]].append(
+ test[u"result"][u"rps"]
+ )
+ else:
+ continue
else:
continue
@@ -630,9 +645,13 @@ def plot_perf_box_name(plot, input_data):
tst_name = re.sub(REGEX_NIC, u"",
col.lower().replace(u'-ndrpdr', u'').
replace(u'2n1l-', u''))
+ if test_type in (u"VSAP_CPS", u"VSAP_RPS"):
+ data_y = [y if y else None for y in df_y[col]]
+ else:
+ data_y = [y / 1e6 if y else None for y in df_y[col]]
kwargs = dict(
x=[str(i + 1) + u'.'] * len(df_y[col]),
- y=[y / 1e6 if y else None for y in df_y[col]],
+ y=data_y,
name=(
f"{i + 1}. "
f"({nr_of_samples[i]:02d} "
@@ -649,7 +668,7 @@ def plot_perf_box_name(plot, input_data):
try:
val_max = max(df_y[col])
if val_max:
- y_max.append(int(val_max / 1e6) + 2)
+ y_max.append(int(val_max / 1e6))
except (ValueError, TypeError) as err:
logging.error(repr(err))
continue
@@ -660,10 +679,16 @@ def plot_perf_box_name(plot, input_data):
if layout.get(u"title", None):
if test_type in (u"HOSTSTACK", ):
layout[u"title"] = f"Bandwidth: {layout[u'title']}"
+ elif test_type == u"VSAP_CPS":
+ layout[u"title"] = f"CPS: {layout[u'title']}"
+ layout[u"yaxis"][u"title"] = u"Connection Rate [cps]"
+ elif test_type == u"VSAP_RPS":
+ layout[u"title"] = f"RPS: {layout[u'title']}"
+ layout[u"yaxis"][u"title"] = u"Connection Rate [rps]"
else:
- layout[u"title"] = f"Throughput: {layout[u'title']}"
- if y_max:
- layout[u"yaxis"][u"range"] = [0, max(y_max)]
+ layout[u"title"] = f"Tput: {layout[u'title']}"
+ if y_max and max(y_max) > 1:
+ layout[u"yaxis"][u"range"] = [0, max(y_max) + 2]
plpl = plgo.Figure(data=traces, layout=layout)
# Export Plot
@@ -761,8 +786,10 @@ def plot_ndrpdr_box_name(plot, input_data):
hoverinfo=u"y+name"
)
)
- data_y_max.append(max(vals))
-
+ try:
+ data_y_max.append(max(vals))
+ except ValueError as err:
+ logging.warning(f"No values to use.\n{err!r}")
try:
# Create plot
layout = deepcopy(plot[u"layout"])
@@ -773,7 +800,7 @@ def plot_ndrpdr_box_name(plot, input_data):
layout[u"title"] = f"CPS: {layout[u'title']}"
else:
layout[u"title"] = \
- f"Throughput: {layout[u'title']}"
+ f"Tput: {layout[u'title']}"
if data_y_max:
layout[u"yaxis"][u"range"] = [0, max(data_y_max) / 1e6 + 1]
plpl = plgo.Figure(data=traces, layout=layout)
@@ -853,10 +880,10 @@ def plot_mrr_box_name(plot, input_data):
# Add plot traces
traces = list()
- for idx in range(len(data_x)):
+ for idx, x_item in enumerate(data_x):
traces.append(
plgo.Box(
- x=[data_x[idx], ] * len(data_y[idx]),
+ x=[x_item, ] * len(data_y[idx]),
y=data_y[idx],
name=data_names[idx],
hoverinfo=u"y+name"
@@ -868,7 +895,7 @@ def plot_mrr_box_name(plot, input_data):
layout = deepcopy(plot[u"layout"])
if layout.get(u"title", None):
layout[u"title"] = (
- f"Throughput: {layout[u'title'].format(core=core)}"
+ f"Tput: {layout[u'title'].format(core=core)}"
)
if data_y_max:
layout[u"yaxis"][u"range"] = [0, max(data_y_max) + 1]
@@ -986,7 +1013,7 @@ def plot_tsa_name(plot, input_data):
REGEX_NIC,
u"",
test_name.replace(u'-ndrpdr', u'').
- replace(u'2n1l-', u'')
+ replace(u'2n1l-', u'')
)
vals[name] = OrderedDict()
y_val_1 = test_vals[u"1"][0] / 1e6