X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_plots.py;h=4ceeebc7d131145ad9a98089094fae782a528dec;hb=72f18772740b0dde1ed6e44d740f8456ce0546e9;hp=05f525c96af4318d8b486f4a73efebd9d0787b2e;hpb=ef5c30213bb28824a55f4ebbcade6410ee8d2461;p=csit.git
diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py
index 05f525c96a..4ceeebc7d1 100644
--- a/resources/tools/presentation/generator_plots.py
+++ b/resources/tools/presentation/generator_plots.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -61,6 +61,10 @@ 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).
+# Keep it slightly higher to ensure rounding errors to not remove tick mark.
+PERCENTILE_MAX = 99.999501
+
def generate_plots(spec, data):
"""Generate all plots specified in the specification file.
@@ -173,6 +177,7 @@ def plot_hdrh_lat_by_percentile(plot, input_data):
for color, graph in enumerate(graphs):
for idx, direction in enumerate((u"direction1", u"direction2")):
+ previous_x = 0.0
xaxis = list()
yaxis = list()
hovertext = list()
@@ -188,16 +193,23 @@ 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(
+ f"{desc[graph]}
"
+ f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
+ f"Percentile: {previous_x:.5f}-{percentile:.5f}%
"
+ f"Latency: {item.value_iterated_to}uSec"
+ )
xaxis.append(percentile)
yaxis.append(item.value_iterated_to)
hovertext.append(
f"{desc[graph]}
"
f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
- f"Percentile: {percentile:.5f}%
"
+ f"Percentile: {previous_x:.5f}-{percentile:.5f}%
"
f"Latency: {item.value_iterated_to}uSec"
)
+ previous_x = percentile
fig.add_trace(
plgo.Scatter(
x=xaxis,
@@ -208,7 +220,8 @@ def plot_hdrh_lat_by_percentile(plot, input_data):
showlegend=bool(idx),
line=dict(
color=COLORS[color],
- dash=u"dash" if idx % 2 else u"solid"
+ dash=u"solid",
+ width=1 if idx % 2 else 2
),
hovertext=hovertext,
hoverinfo=u"text"
@@ -324,10 +337,11 @@ 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")):
+ previous_x = 0.0
+ prev_perc = 0.0
xaxis = list()
yaxis = list()
hovertext = list()
@@ -342,17 +356,30 @@ 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
- xaxis.append(100.0 / (100.0 - percentile))
+ x_perc = min(percentile, PERCENTILE_MAX)
+ xaxis.append(previous_x)
yaxis.append(item.value_iterated_to)
hovertext.append(
f"{desc[graph]}
"
f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
- f"Percentile: {percentile:.5f}%
"
+ f"Percentile: {prev_perc:.5f}-{percentile:.5f}%
"
f"Latency: {item.value_iterated_to}uSec"
)
+ next_x = 100.0 / (100.0 - x_perc)
+ xaxis.append(next_x)
+ yaxis.append(item.value_iterated_to)
+ hovertext.append(
+ f"{desc[graph]}
"
+ f"Direction: {(u'W-E', u'E-W')[idx % 2]}
"
+ f"Percentile: {prev_perc:.5f}-{percentile:.5f}%
"
+ f"Latency: {item.value_iterated_to}uSec"
+ )
+ previous_x = next_x
+ prev_perc = percentile
fig.add_trace(
plgo.Scatter(
x=xaxis,
@@ -363,17 +390,17 @@ def plot_hdrh_lat_by_percentile_x_log(plot, input_data):
showlegend=not(bool(idx)),
line=dict(
color=COLORS[color],
- dash=u"dash" if idx % 2 else u"solid"
+ dash=u"solid",
+ width=1 if idx % 2 else 2
),
hovertext=hovertext,
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]
+ x_max = log(100.0 / (100.0 - PERCENTILE_MAX), 10)
+ layout[u"xaxis"][u"range"] = [0, x_max]
fig.update_layout(layout)
# Create plot
@@ -461,19 +488,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"
))