- if "1C" in test["tags"]:
- y_vals[test["parent"]]["1"]. \
- append(test["throughput"][ttype]["LOWER"])
- elif "2C" in test["tags"]:
- y_vals[test["parent"]]["2"]. \
- append(test["throughput"][ttype]["LOWER"])
- elif "4C" in test["tags"]:
- y_vals[test["parent"]]["4"]. \
- append(test["throughput"][ttype]["LOWER"])
- except (KeyError, TypeError):
- pass
-
- if not y_vals:
- logging.warning("No data for the plot '{}'".
- format(plot.get("title", "")))
- return
-
- y_1c_max = dict()
- for test_name, test_vals in y_vals.items():
- for key, test_val in test_vals.items():
- if test_val:
- avg_val = sum(test_val) / len(test_val)
- y_vals[test_name][key] = (avg_val, len(test_val))
- ideal = avg_val / (int(key) * 1000000.0)
- if test_name not in y_1c_max or ideal > y_1c_max[test_name]:
- y_1c_max[test_name] = ideal
-
- vals = OrderedDict()
- y_max = list()
- nic_limit = 0
- lnk_limit = 0
- pci_limit = plot["limits"]["pci"]["pci-g3-x8"]
- for test_name, test_vals in y_vals.items():
- try:
- if test_vals["1"][1]:
- name = re.sub(REGEX_NIC, "", test_name.replace('-ndrpdr', '').
- replace('2n1l-', ''))
- vals[name] = OrderedDict()
- y_val_1 = test_vals["1"][0] / 1000000.0
- y_val_2 = test_vals["2"][0] / 1000000.0 if test_vals["2"][0] \
- else None
- y_val_4 = test_vals["4"][0] / 1000000.0 if test_vals["4"][0] \
- else None
-
- vals[name]["val"] = [y_val_1, y_val_2, y_val_4]
- vals[name]["rel"] = [1.0, None, None]
- vals[name]["ideal"] = [y_1c_max[test_name],
- y_1c_max[test_name] * 2,
- y_1c_max[test_name] * 4]
- vals[name]["diff"] = [(y_val_1 - y_1c_max[test_name]) * 100 /
- y_val_1, None, None]
- vals[name]["count"] = [test_vals["1"][1],
- test_vals["2"][1],
- test_vals["4"][1]]
-
- try:
- val_max = max(vals[name]["val"])
- except ValueError as err:
- logging.error(repr(err))
- continue
- if val_max:
- y_max.append(val_max)
-
- if y_val_2:
- vals[name]["rel"][1] = round(y_val_2 / y_val_1, 2)
- vals[name]["diff"][1] = \
- (y_val_2 - vals[name]["ideal"][1]) * 100 / y_val_2
- if y_val_4:
- vals[name]["rel"][2] = round(y_val_4 / y_val_1, 2)
- vals[name]["diff"][2] = \
- (y_val_4 - vals[name]["ideal"][2]) * 100 / y_val_4
- except IndexError as err:
- logging.warning("No data for '{0}'".format(test_name))
- logging.warning(repr(err))
-
- # Limits:
- if "x520" in test_name:
- limit = plot["limits"]["nic"]["x520"]
- elif "x710" in test_name:
- limit = plot["limits"]["nic"]["x710"]
- elif "xxv710" in test_name:
- limit = plot["limits"]["nic"]["xxv710"]
- elif "xl710" in test_name:
- limit = plot["limits"]["nic"]["xl710"]
- elif "x553" in test_name:
- limit = plot["limits"]["nic"]["x553"]
- else:
- limit = 0
- if limit > nic_limit:
- nic_limit = limit
-
- mul = 2 if "ge2p" in test_name else 1
- if "10ge" in test_name:
- limit = plot["limits"]["link"]["10ge"] * mul
- elif "25ge" in test_name:
- limit = plot["limits"]["link"]["25ge"] * mul
- elif "40ge" in test_name:
- limit = plot["limits"]["link"]["40ge"] * mul
- elif "100ge" in test_name:
- limit = plot["limits"]["link"]["100ge"] * mul
- else:
- limit = 0
- if limit > lnk_limit:
- lnk_limit = limit
-
- traces = list()
- annotations = list()
- x_vals = [1, 2, 4]
-
- # Limits:
- try:
- threshold = 1.1 * max(y_max) # 10%
- except ValueError as err:
- logging.error(err)
- return
- nic_limit /= 1000000.0
- traces.append(plgo.Scatter(
- x=x_vals,
- y=[nic_limit, ] * len(x_vals),
- name="NIC: {0:.2f}Mpps".format(nic_limit),
- showlegend=False,
- mode="lines",
- line=dict(
- dash="dot",
- color=COLORS[-1],
- width=1),
- hoverinfo="none"
- ))
- annotations.append(dict(
- x=1,
- y=nic_limit,
- xref="x",
- yref="y",
- xanchor="left",
- yanchor="bottom",
- text="NIC: {0:.2f}Mpps".format(nic_limit),
- font=dict(
- size=14,
- color=COLORS[-1],
- ),
- align="left",
- showarrow=False
- ))
- y_max.append(nic_limit)
-
- lnk_limit /= 1000000.0
- if lnk_limit < threshold:
- traces.append(plgo.Scatter(
- x=x_vals,
- y=[lnk_limit, ] * len(x_vals),
- name="Link: {0:.2f}Mpps".format(lnk_limit),
- showlegend=False,
- mode="lines",
- line=dict(
- dash="dot",
- color=COLORS[-2],
- width=1),
- hoverinfo="none"
- ))
- annotations.append(dict(
- x=1,
- y=lnk_limit,
- xref="x",
- yref="y",
- xanchor="left",
- yanchor="bottom",
- text="Link: {0:.2f}Mpps".format(lnk_limit),
- font=dict(
- size=14,
- color=COLORS[-2],
- ),
- align="left",
- showarrow=False
- ))
- y_max.append(lnk_limit)
-
- pci_limit /= 1000000.0
- if (pci_limit < threshold and
- (pci_limit < lnk_limit * 0.95 or lnk_limit > lnk_limit * 1.05)):
- traces.append(plgo.Scatter(
- x=x_vals,
- y=[pci_limit, ] * len(x_vals),
- name="PCIe: {0:.2f}Mpps".format(pci_limit),
- showlegend=False,
- mode="lines",
- line=dict(
- dash="dot",
- color=COLORS[-3],
- width=1),
- hoverinfo="none"
- ))
- annotations.append(dict(
- x=1,
- y=pci_limit,
- xref="x",
- yref="y",
- xanchor="left",
- yanchor="bottom",
- text="PCIe: {0:.2f}Mpps".format(pci_limit),
- font=dict(
- size=14,
- color=COLORS[-3],
- ),
- align="left",
- showarrow=False
- ))
- y_max.append(pci_limit)
-
- # Perfect and measured:
- cidx = 0
- for name, val in vals.iteritems():
- hovertext = list()
+ if y_vals.get(test[u"parent"], None) is None:
+ y_vals[test[u"parent"]] = list()
+ loss[test[u"parent"]] = list()
+ try:
+ y_vals[test[u"parent"]].append(
+ test[u"result"][u"time"]
+ )
+ loss[test[u"parent"]].append(
+ test[u"result"][u"loss"]
+ )
+ except (KeyError, TypeError):
+ y_vals[test[u"parent"]].append(None)
+
+ # Add None to the lists with missing data
+ max_len = 0
+ nr_of_samples = list()
+ for val in y_vals.values():
+ if len(val) > max_len:
+ max_len = len(val)
+ nr_of_samples.append(len(val))
+ for val in y_vals.values():
+ if len(val) < max_len:
+ val.extend([None for _ in range(max_len - len(val))])
+
+ # Add plot traces
+ traces = list()
+ 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'-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=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'-')[2:])}"
+ ),
+ hoverinfo=u"y+name"
+ ))