From 419b091b7e79e8f35c99fd10d6ea34c6ff3d7723 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Wed, 29 Jun 2022 14:27:19 +0200 Subject: [PATCH] UTI: Add normalization to iterative data Change-Id: Iedfadd0a6a2b360e047b348bc21b35c2d2be1f24 Signed-off-by: Tibor Frank --- resources/tools/dash/app/pal/data/tooltips.yaml | 3 + resources/tools/dash/app/pal/report/graphs.py | 36 ++++++++-- resources/tools/dash/app/pal/report/layout.py | 96 ++++++++++++++----------- 3 files changed, 89 insertions(+), 46 deletions(-) diff --git a/resources/tools/dash/app/pal/data/tooltips.yaml b/resources/tools/dash/app/pal/data/tooltips.yaml index 5a830e4b68..2086b575a9 100644 --- a/resources/tools/dash/app/pal/data/tooltips.yaml +++ b/resources/tools/dash/app/pal/data/tooltips.yaml @@ -19,6 +19,9 @@ help-framesize: help-infra: Infrastructure is defined by the toplology (number of nodes), processor architecture, NIC and driver. +help-normalize: + Normalize the results to CPU frequency 2GHz. The results from AWS environment + are not normalized as we do not know the exact value of CPU frequency. help-release: The CSIT release. help-tbed: diff --git a/resources/tools/dash/app/pal/report/graphs.py b/resources/tools/dash/app/pal/report/graphs.py index d5dd0b8cce..92cf5ca989 100644 --- a/resources/tools/dash/app/pal/report/graphs.py +++ b/resources/tools/dash/app/pal/report/graphs.py @@ -24,6 +24,22 @@ import hdrh.histogram import hdrh.codec +_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 +} + _VALUE = { "mrr": "result_receive_rate_rate_values", "ndr": "result_ndr_lower_rate_value", @@ -144,7 +160,8 @@ def select_iterative_data(data: pd.DataFrame, itm:dict) -> pd.DataFrame: return df -def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict) -> tuple: +def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict, + normalize: bool) -> tuple: """ """ @@ -162,13 +179,18 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict) -> tuple: itm_data = select_iterative_data(data, itm) if itm_data.empty: 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 if itm["testtype"] == "mrr": - y_data = itm_data[_VALUE[itm["testtype"]]].to_list()[0] - if y_data.size > 0: + y_data_raw = itm_data[_VALUE[itm["testtype"]]].to_list()[0] + y_data = [y * norm_factor for y in y_data_raw] + if len(y_data) > 0: y_tput_max = \ max(y_data) if max(y_data) > y_tput_max else y_tput_max else: - y_data = itm_data[_VALUE[itm["testtype"]]].to_list() + y_data_raw = itm_data[_VALUE[itm["testtype"]]].to_list() + y_data = [y * norm_factor for y in y_data_raw] if y_data: y_tput_max = \ max(y_data) if max(y_data) > y_tput_max else y_tput_max @@ -190,7 +212,8 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict) -> tuple: show_tput = True if itm["testtype"] == "pdr": - y_lat = itm_data[_VALUE["pdr-lat"]].to_list() + y_lat_row = itm_data[_VALUE["pdr-lat"]].to_list() + y_lat = [y * norm_factor for y in y_lat_row] if y_lat: y_lat_max = max(y_lat) if max(y_lat) > y_lat_max else y_lat_max nr_of_samples = len(y_lat) @@ -232,7 +255,8 @@ def graph_iterative(data: pd.DataFrame, sel:dict, layout: dict) -> tuple: return fig_tput, fig_lat -def table_comparison(data: pd.DataFrame, sel:dict) -> pd.DataFrame: +def table_comparison(data: pd.DataFrame, sel:dict, + normalize: bool) -> pd.DataFrame: """ """ table = pd.DataFrame( diff --git a/resources/tools/dash/app/pal/report/layout.py b/resources/tools/dash/app/pal/report/layout.py index 081a0fd29f..d85dbe7657 100644 --- a/resources/tools/dash/app/pal/report/layout.py +++ b/resources/tools/dash/app/pal/report/layout.py @@ -628,6 +628,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=[ @@ -731,6 +759,7 @@ class Layout: "cl-testtype-all-value": list(), "cl-testtype-all-options": CL_ALL_DISABLED, "btn-add-disabled": True, + "cl-normalize-value": list(), "cl-selected-options": list() } @@ -898,6 +927,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 @@ -914,6 +944,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("btn-sel-remove", "n_clicks"), Input("btn-sel-remove-all", "n_clicks"), @@ -923,8 +954,8 @@ class Layout: dd_rls: str, dd_dut: str, dd_dutver: 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, btn_remove: int, btn_remove_all: int, - href: str) -> tuple: + cl_normalize: list, btn_add: int, btn_remove: int, + btn_remove_all: int, href: str) -> tuple: """ """ @@ -943,7 +974,6 @@ class Layout: new_url = str() return new_url - ctrl_panel = self.ControlPanel(cp_data) # Parse the url: @@ -1282,12 +1312,6 @@ class Layout: ctrl_panel.set({ "cl-selected-options": self._list_tests(store_sel) }) - row_fig_tput, row_fig_lat, row_table, row_btn_dwnld = \ - _generate_plotting_area( - graph_iterative(self.data, store_sel, self.layout), - table_comparison(self.data, store_sel), - _gen_new_url(parsed_url, store_sel) - ) elif trigger_id == "btn-sel-remove-all": _ = btn_remove_all row_fig_tput = self.PLACEHOLDER @@ -1306,11 +1330,28 @@ 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]) + 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", "btn-sel-remove-all", + "btn-sel-remove", "cl-ctrl-normalize"): if store_sel: row_fig_tput, row_fig_lat, row_table, row_btn_dwnld = \ _generate_plotting_area( - graph_iterative(self.data, store_sel, self.layout), - table_comparison(self.data, store_sel), + graph_iterative( + self.data, store_sel, self.layout, + bool(cl_normalize) + ), + table_comparison( + self.data, store_sel, bool(cl_normalize) + ), _gen_new_url(parsed_url, store_sel) ) ctrl_panel.set({ @@ -1325,34 +1366,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]) - if store_sel: - row_fig_tput, row_fig_lat, row_table, row_btn_dwnld = \ - _generate_plotting_area( - graph_iterative(self.data, store_sel, - self.layout), - table_comparison(self.data, store_sel), - _gen_new_url(parsed_url, store_sel) - ) - 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_table = 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-core-value") and \ ctrl_panel.get("cl-framesize-value") and \ @@ -1360,7 +1373,10 @@ class Layout: disabled = False else: disabled = True - ctrl_panel.set({"btn-add-disabled": disabled}) + ctrl_panel.set({ + "btn-add-disabled": disabled, + "cl-normalize-value": cl_normalize + }) ret_val = [ ctrl_panel.panel, store_sel, -- 2.16.6