X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_plots.py;h=88af4a46657830040f2c16a7c01d80930037c027;hp=dd0093941508e6bfcd742bf41e72481fdae8ad00;hb=879b31f02fb4df52016d7465e21377121dfbb515;hpb=826d80373dbd20bc1feac2403e9cade9e5633336
diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py
index dd00939415..88af4a4665 100644
--- a/resources/tools/presentation/generator_plots.py
+++ b/resources/tools/presentation/generator_plots.py
@@ -61,6 +61,9 @@ COLORS = (
REGEX_NIC = re.compile(r'(\d*ge\dp\d\D*\d*[a-z]*)-')
+# This value depends on latency stream rate (9001 pps) and duration (5s).
+PERCENTILE_MAX = 99.9995
+
def generate_plots(spec, data):
"""Generate all plots specified in the specification file.
@@ -189,8 +192,6 @@ def plot_hdrh_lat_by_percentile(plot, input_data):
for item in decoded.get_recorded_iterator():
percentile = item.percentile_level_iterated_to
- if percentile > 99.9999999:
- continue
xaxis.append(previous_x)
yaxis.append(item.value_iterated_to)
hovertext.append(
@@ -335,7 +336,6 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
fig = plgo.Figure()
layout = deepcopy(plot[u"layout"])
- xaxis_max = 0
for color, graph in enumerate(graphs):
for idx, direction in enumerate((u"direction1", u"direction2")):
@@ -355,9 +355,11 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
continue
for item in decoded.get_recorded_iterator():
+ # The real value is "percentile".
+ # For 100%, we cut that down to "x_perc" to avoid
+ # infinity.
percentile = item.percentile_level_iterated_to
- if percentile > 99.9999999:
- continue
+ x_perc = min(percentile, PERCENTILE_MAX)
xaxis.append(previous_x)
yaxis.append(item.value_iterated_to)
hovertext.append(
@@ -366,7 +368,7 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
f"Percentile: {prev_perc:.5f}-{percentile:.5f}%
"
f"Latency: {item.value_iterated_to}uSec"
)
- next_x = 100.0 / (100.0 - percentile)
+ next_x = 100.0 / (100.0 - x_perc)
xaxis.append(next_x)
yaxis.append(item.value_iterated_to)
hovertext.append(
@@ -394,11 +396,12 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
hoverinfo=u"text"
)
)
- xaxis_max = max(xaxis) if xaxis_max < max(
- xaxis) else xaxis_max
layout[u"title"][u"text"] = f"Latency: {name}"
- layout[u"xaxis"][u"range"] = [0, int(log(xaxis_max, 10)) + 1]
+ layout[u"xaxis"][u"range"] = [0, 5]
+ # layout[u"xaxis"][u"range"] = [
+ # 0, round(log(100.0 / (100.0 - PERCENTILE_MAX), 10))
+ # ]
fig.update_layout(layout)
# Create plot
@@ -486,19 +489,21 @@ def plot_nf_reconf_box_name(plot, input_data):
df_y = pd.DataFrame(y_vals)
df_y.head()
for i, col in enumerate(df_y.columns):
+
tst_name = re.sub(REGEX_NIC, u"",
- col.lower().replace(u'-ndrpdr', u'').
- replace(u'2n1l-', u''))
+ col.lower().replace(u'-reconf', u'').
+ replace(u'2n1l-', u'').replace(u'2n-', u'').
+ replace(u'-testpmd', u''))
traces.append(plgo.Box(
x=[str(i + 1) + u'.'] * len(df_y[col]),
- y=[y if y else None for y in df_y[col]],
+ y=df_y[col],
name=(
f"{i + 1}. "
f"({nr_of_samples[i]:02d} "
f"run{u's' if nr_of_samples[i] > 1 else u''}, "
f"packets lost average: {mean(loss[col]):.1f}) "
- f"{u'-'.join(tst_name.split(u'-')[3:-2])}"
+ f"{u'-'.join(tst_name.split(u'-')[2:])}"
),
hoverinfo=u"y+name"
))