aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-07-15 11:15:05 +0200
committerTibor Frank <tifrank@cisco.com>2022-07-18 05:21:27 +0000
commit06d3f7331f9f10d99baa334b1808dfdc9c6fc8be (patch)
treec39eb6181f0261101048bedc0ee21f024a01302e /resources
parent1b2710767a34113c266c81a18b98d71e0c8dd6ef (diff)
UTI: Normalize trending data
Change-Id: I6cc2c73707e9e3a0ab0f28033526a612804ee20a Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/tools/dash/app/pal/report/graphs.py4
-rw-r--r--resources/tools/dash/app/pal/report/layout.py4
-rw-r--r--resources/tools/dash/app/pal/trending/graphs.py38
-rw-r--r--resources/tools/dash/app/pal/trending/layout.py106
4 files changed, 89 insertions, 63 deletions
diff --git a/resources/tools/dash/app/pal/report/graphs.py b/resources/tools/dash/app/pal/report/graphs.py
index 92cf5ca989..0543193d99 100644
--- a/resources/tools/dash/app/pal/report/graphs.py
+++ b/resources/tools/dash/app/pal/report/graphs.py
@@ -24,6 +24,7 @@ import hdrh.histogram
import hdrh.codec
+_NORM_FREQUENCY = 2.0 # [GHz]
_FREQURENCY = { # [GHz]
"2n-aws": 1.000,
"2n-dnv": 2.000,
@@ -181,7 +182,8 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict,
continue
phy = itm["phy"].split("-")
topo_arch = f"{phy[0]}-{phy[1]}" if len(phy) == 4 else str()
- norm_factor = 2.0 / _FREQURENCY[topo_arch] if normalize else 1.0
+ norm_factor = (_NORM_FREQUENCY / _FREQURENCY[topo_arch]) \
+ if normalize else 1.0
if itm["testtype"] == "mrr":
y_data_raw = itm_data[_VALUE[itm["testtype"]]].to_list()[0]
y_data = [y * norm_factor for y in y_data_raw]
diff --git a/resources/tools/dash/app/pal/report/layout.py b/resources/tools/dash/app/pal/report/layout.py
index d85dbe7657..e7c8db43ae 100644
--- a/resources/tools/dash/app/pal/report/layout.py
+++ b/resources/tools/dash/app/pal/report/layout.py
@@ -1340,8 +1340,8 @@ class Layout:
row_card_sel_tests = self.STYLE_ENABLED
row_btns_sel_tests = self.STYLE_ENABLED
- if trigger_id in ("btn-ctrl-add", "url", "btn-sel-remove-all",
- "btn-sel-remove", "cl-ctrl-normalize"):
+ if trigger_id in ("btn-ctrl-add", "url", "btn-sel-remove",
+ "cl-ctrl-normalize"):
if store_sel:
row_fig_tput, row_fig_lat, row_table, row_btn_dwnld = \
_generate_plotting_area(
diff --git a/resources/tools/dash/app/pal/trending/graphs.py b/resources/tools/dash/app/pal/trending/graphs.py
index fb87cec953..150b7056ba 100644
--- a/resources/tools/dash/app/pal/trending/graphs.py
+++ b/resources/tools/dash/app/pal/trending/graphs.py
@@ -14,6 +14,7 @@
"""
"""
+import logging
import plotly.graph_objects as go
import pandas as pd
@@ -26,6 +27,23 @@ from numpy import isnan
from ..jumpavg import classify
+_NORM_FREQUENCY = 2.0 # [GHz]
+_FREQURENCY = { # [GHz]
+ "2n-aws": 1.000,
+ "2n-dnv": 2.000,
+ "2n-clx": 2.300,
+ "2n-icx": 2.600,
+ "2n-skx": 2.500,
+ "2n-tx2": 2.500,
+ "2n-zn2": 2.900,
+ "3n-alt": 3.000,
+ "3n-aws": 1.000,
+ "3n-dnv": 2.000,
+ "3n-icx": 2.600,
+ "3n-skx": 2.500,
+ "3n-tsh": 2.200
+}
+
_ANOMALY_COLOR = {
"regression": 0.0,
"normal": 0.5,
@@ -207,7 +225,7 @@ def select_trending_data(data: pd.DataFrame, itm:dict) -> pd.DataFrame:
def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
- start: datetime, end: datetime, color: str) -> list:
+ start: datetime, end: datetime, color: str, norm_factor: float) -> list:
"""
"""
@@ -219,9 +237,10 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
return list()
x_axis = df["start_time"].tolist()
+ y_data = [itm * norm_factor for itm in df[_VALUE[ttype]].tolist()]
anomalies, trend_avg, trend_stdev = _classify_anomalies(
- {k: v for k, v in zip(x_axis, df[_VALUE[ttype]])}
+ {k: v for k, v in zip(x_axis, y_data)}
)
hover = list()
@@ -268,7 +287,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
traces = [
go.Scatter( # Samples
x=x_axis,
- y=df[_VALUE[ttype]],
+ y=y_data,
name=name,
mode="markers",
marker={
@@ -360,7 +379,7 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
- start: datetime, end: datetime) -> tuple:
+ start: datetime, end: datetime, normalize: bool) -> tuple:
"""
"""
@@ -377,8 +396,15 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
name = "-".join((itm["dut"], itm["phy"], itm["framesize"], itm["core"],
itm["test"], itm["testtype"], ))
+ if normalize:
+ phy = itm["phy"].split("-")
+ topo_arch = f"{phy[0]}-{phy[1]}" if len(phy) == 4 else str()
+ norm_factor = (_NORM_FREQUENCY / _FREQURENCY[topo_arch]) \
+ if topo_arch else 1.0
+ else:
+ norm_factor = 1.0
traces = _generate_trending_traces(
- itm["testtype"], name, df, start, end, _get_color(idx)
+ itm["testtype"], name, df, start, end, _get_color(idx), norm_factor
)
if traces:
if not fig_tput:
@@ -387,7 +413,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict,
if itm["testtype"] == "pdr":
traces = _generate_trending_traces(
- "pdr-lat", name, df, start, end, _get_color(idx)
+ "pdr-lat", name, df, start, end, _get_color(idx), norm_factor
)
if traces:
if not fig_lat:
diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py
index 55d0d08e83..c21e4b3c2e 100644
--- a/resources/tools/dash/app/pal/trending/layout.py
+++ b/resources/tools/dash/app/pal/trending/layout.py
@@ -578,6 +578,34 @@ class Layout:
]
),
dbc.Row(
+ id="row-ctrl-normalize",
+ class_name="gy-1",
+ children=[
+ dbc.Label(
+ children=self._show_tooltip(
+ "help-normalize", "Normalize"),
+ class_name="p-0"
+ ),
+ dbc.Col(
+ children=[
+ dbc.Checklist(
+ id="cl-ctrl-normalize",
+ options=[{
+ "value": "normalize",
+ "label": (
+ "Normalize results to CPU"
+ "frequency 2GHz"
+ )
+ }],
+ value=[],
+ inline=True,
+ switch=False
+ ),
+ ]
+ )
+ ]
+ ),
+ dbc.Row(
class_name="gy-1 p-0",
children=[
dbc.ButtonGroup(
@@ -698,6 +726,7 @@ class Layout:
"cl-ctrl-testtype-all-value": list(),
"cl-ctrl-testtype-all-options": CL_ALL_DISABLED,
"btn-ctrl-add-disabled": True,
+ "cl-normalize-value": list(),
"cl-selected-options": list(),
}
@@ -850,6 +879,7 @@ class Layout:
Output("cl-ctrl-testtype-all", "value"),
Output("cl-ctrl-testtype-all", "options"),
Output("btn-ctrl-add", "disabled"),
+ Output("cl-ctrl-normalize", "value"),
Output("cl-selected", "options"), # User selection
State("control-panel", "data"), # Store
State("selected-tests", "data"), # Store
@@ -864,6 +894,7 @@ class Layout:
Input("cl-ctrl-framesize-all", "value"),
Input("cl-ctrl-testtype", "value"),
Input("cl-ctrl-testtype-all", "value"),
+ Input("cl-ctrl-normalize", "value"),
Input("btn-ctrl-add", "n_clicks"),
Input("dpr-period", "start_date"),
Input("dpr-period", "end_date"),
@@ -874,8 +905,8 @@ class Layout:
def _update_ctrl_panel(cp_data: dict, store_sel: list, list_sel: list,
dd_dut: str, dd_phy: str, dd_area: str, dd_test: str, cl_core: list,
cl_core_all: list, cl_framesize: list, cl_framesize_all: list,
- cl_testtype: list, cl_testtype_all: list, btn_add: int,
- d_start: str, d_end: str, btn_remove: int,
+ cl_testtype: list, cl_testtype_all: list, cl_normalize: list,
+ btn_add: int, d_start: str, d_end: str, btn_remove: int,
btn_remove_all: int, href: str) -> tuple:
"""
"""
@@ -1153,22 +1184,6 @@ class Layout:
row_btns_sel_tests = self.STYLE_ENABLED
if self.CLEAR_ALL_INPUTS:
ctrl_panel.set(ctrl_panel.defaults)
- ctrl_panel.set({
- "cl-selected-options": self._list_tests(store_sel)
- })
- row_fig_tput, row_fig_lat, row_btn_dwnld = \
- _generate_plotting_area(
- graph_trending(self.data, store_sel, self.layout,
- d_start, d_end),
- _gen_new_url(parsed_url, store_sel, d_start, d_end)
- )
- elif trigger_id == "dpr-period":
- row_fig_tput, row_fig_lat, row_btn_dwnld = \
- _generate_plotting_area(
- graph_trending(self.data, store_sel, self.layout,
- d_start, d_end),
- _gen_new_url(parsed_url, store_sel, d_start, d_end)
- )
elif trigger_id == "btn-sel-remove-all":
_ = btn_remove_all
row_fig_tput = self.PLACEHOLDER
@@ -1186,11 +1201,25 @@ class Layout:
if item["id"] not in list_sel:
new_store_sel.append(item)
store_sel = new_store_sel
+ elif trigger_id == "url":
+ # TODO: Add verification
+ url_params = parsed_url["params"]
+ if url_params:
+ store_sel = literal_eval(
+ url_params.get("store_sel", list())[0])
+ d_start = self._get_date(url_params.get("start", list())[0])
+ d_end = self._get_date(url_params.get("end", list())[0])
+ if store_sel:
+ row_card_sel_tests = self.STYLE_ENABLED
+ row_btns_sel_tests = self.STYLE_ENABLED
+
+ if trigger_id in ("btn-ctrl-add", "url", "dpr-period"
+ "btn-sel-remove", "cl-ctrl-normalize"):
if store_sel:
row_fig_tput, row_fig_lat, row_btn_dwnld = \
_generate_plotting_area(
graph_trending(self.data, store_sel, self.layout,
- d_start, d_end),
+ d_start, d_end, bool(cl_normalize)),
_gen_new_url(parsed_url, store_sel, d_start, d_end)
)
ctrl_panel.set({
@@ -1204,40 +1233,6 @@ class Layout:
row_btns_sel_tests = self.STYLE_DISABLED
store_sel = list()
ctrl_panel.set({"cl-selected-options": list()})
- elif trigger_id == "url":
- # TODO: Add verification
- url_params = parsed_url["params"]
- if url_params:
- store_sel = literal_eval(
- url_params.get("store_sel", list())[0])
- d_start = self._get_date(url_params.get("start", list())[0])
- d_end = self._get_date(url_params.get("end", list())[0])
- if store_sel:
- row_fig_tput, row_fig_lat, row_btn_dwnld = \
- _generate_plotting_area(
- graph_trending(
- self.data, store_sel, self.layout, d_start,
- d_end
- ),
- _gen_new_url(
- parsed_url, store_sel, d_start, d_end
- )
- )
- row_card_sel_tests = self.STYLE_ENABLED
- row_btns_sel_tests = self.STYLE_ENABLED
- ctrl_panel.set({
- "cl-selected-options": self._list_tests(store_sel)
- })
- else:
- row_fig_tput = self.PLACEHOLDER
- row_fig_lat = self.PLACEHOLDER
- row_btn_dwnld = self.PLACEHOLDER
- row_card_sel_tests = self.STYLE_DISABLED
- row_btns_sel_tests = self.STYLE_DISABLED
- store_sel = list()
- ctrl_panel.set({
- "cl-selected-options": list()
- })
if ctrl_panel.get("cl-ctrl-core-value") and \
ctrl_panel.get("cl-ctrl-framesize-value") and \
@@ -1245,7 +1240,10 @@ class Layout:
disabled = False
else:
disabled = True
- ctrl_panel.set({"btn-ctrl-add-disabled": disabled})
+ ctrl_panel.set({
+ "btn-ctrl-add-disabled": disabled,
+ "cl-normalize-value": cl_normalize
+ })
ret_val = [
ctrl_panel.panel, store_sel,