X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=resources%2Ftools%2Fdash%2Fapp%2Fpal%2Ftrending%2Fgraphs.py;h=895055816635a9d93d76a30ea7889c1ba14976c9;hb=2f6295d7c63b7e231b0198ee055468b2fc54fa94;hp=fb87cec953655689e99c859765b63398232d2f2b;hpb=d294d31e7cadd858c1c27dae9b5a85732aa95b23;p=csit.git
diff --git a/resources/tools/dash/app/pal/trending/graphs.py b/resources/tools/dash/app/pal/trending/graphs.py
index fb87cec953..8950558166 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,18 +237,22 @@ def _generate_trending_traces(ttype: str, name: str, df: pd.DataFrame,
return list()
x_axis = df["start_time"].tolist()
+ if ttype == "pdr-lat":
+ y_data = [(itm / norm_factor) for itm in df[_VALUE[ttype]].tolist()]
+ else:
+ 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()
customdata = list()
- for _, row in df.iterrows():
+ for idx, (_, row) in enumerate(df.iterrows()):
d_type = "trex" if row["dut_type"] == "none" else row["dut_type"]
hover_itm = (
f"date: {row['start_time'].strftime('%Y-%m-%d %H:%M:%S')}
"
- f" [{row[_UNIT[ttype]]}]: {row[_VALUE[ttype]]:,.0f}
"
+ f" [{row[_UNIT[ttype]]}]: {y_data[idx]:,.0f}
"
f""
f"{d_type}-ref: {row['dut_version']}
"
f"csit-ref: {row['job']}/{row['build']}
"
@@ -268,7 +290,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 +382,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 +399,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 +416,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: