C-Dash: Comparison tables - add latency 04/38604/1
authorTibor Frank <tifrank@cisco.com>
Tue, 4 Apr 2023 13:20:00 +0000 (15:20 +0200)
committerTibor Frank <tifrank@cisco.com>
Tue, 4 Apr 2023 13:20:00 +0000 (15:20 +0200)
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Change-Id: Iddbaa5bdc87a52ed9075f3e07c2d4f732490603d

csit.infra.dash/app/cdash/comparisons/layout.py
csit.infra.dash/app/cdash/comparisons/tables.py
csit.infra.dash/app/cdash/utils/constants.py

index bb4c6dd..489e6eb 100644 (file)
@@ -62,7 +62,7 @@ CMP_PARAMS = {
     "infra": "Infrastructure",
     "frmsize": "Frame Size",
     "core": "Number of Cores",
-    "ttype": "Test Type"
+    "ttype": "Measurement"
 }
 
 
@@ -142,7 +142,9 @@ class Layout:
                     tbs[dut][dver][infra]["ttype"].append("MRR")
             elif row["test_type"] == "ndrpdr":
                 if "NDR" not in tbs[dut][dver][infra]["ttype"]:
-                    tbs[dut][dver][infra]["ttype"].extend(("NDR", "PDR", ))
+                    tbs[dut][dver][infra]["ttype"].extend(
+                        ("NDR", "PDR", "Latency")
+                    )
             elif row["test_type"] == "hoststack" and \
                     row["tg_type"] in ("iperf", "vpp"):
                 if "BPS" not in tbs[dut][dver][infra]["ttype"]:
@@ -383,7 +385,7 @@ class Layout:
                 children=[
                     dbc.InputGroup(
                         [
-                            dbc.InputGroupText("Test Type"),
+                            dbc.InputGroupText("Measurement"),
                             dbc.Checklist(
                                 id={"type": "ctrl-cl", "index": "ttype"},
                                 inline=True,
@@ -865,6 +867,8 @@ class Layout:
                     for itm in ctrl_panel.get(f"{value}-opt"):
                         set_val = ctrl_panel.get(f"{value}-val")
                         if isinstance(set_val, list):
+                            if itm["value"] == "Latency":
+                                continue
                             if itm["value"] not in set_val:
                                 opts.append(itm)
                         else:
@@ -900,8 +904,13 @@ class Layout:
                 if all((ctrl_panel.get("core-val"),
                         ctrl_panel.get("frmsize-val"),
                         ctrl_panel.get("ttype-val"), )):
+                    if "Latency" in ctrl_panel.get("ttype-val"):
+                        ctrl_panel.set({"ttype-val": ["Latency", ]})
                     opts = list()
                     for itm, label in CMP_PARAMS.items():
+                        if "Latency" in ctrl_panel.get("ttype-val") and \
+                                itm == "ttype":
+                            continue
                         if len(ctrl_panel.get(f"{itm}-opt")) > 1:
                             if isinstance(ctrl_panel.get(f"{itm}-val"), list):
                                 if len(ctrl_panel.get(f"{itm}-opt")) == \
index 14d5d55..b2bee7f 100644 (file)
@@ -77,16 +77,23 @@ def select_comparison_data(
                 for l_itm in l_df:
                     tmp_df.extend(l_itm)
                 l_df = tmp_df
+            try:
+                mean_val = mean(l_df)
+                std_val = std(l_df)
+            except (TypeError, ValueError):
+                continue
             d_data["name"].append(f"{test.replace(f'{drv}-', '')}-{ttype}")
-            d_data["mean"].append(int(mean(l_df) * norm_factor))
-            d_data["stdev"].append(int(std(l_df) * norm_factor))
+            d_data["mean"].append(int(mean_val * norm_factor))
+            d_data["stdev"].append(int(std_val * norm_factor))
             d_data["unit"].append(df[C.UNIT[ttype]].to_list()[0])
         return pd.DataFrame(d_data)
 
     lst_df = list()
     for itm in selected:
-        if itm["ttype"] in ("NDR", "PDR"):
+        if itm["ttype"] in ("NDR", "PDR", "Latency"):
             test_type = "ndrpdr"
+        elif itm["ttype"] in ("CPS", "RPS", "BPS"):
+            test_type  = "hoststack"
         else:
             test_type = itm["ttype"].lower()
 
@@ -114,16 +121,23 @@ def select_comparison_data(
                     inplace=True
                 )
 
-        # Change the data type from ndrpdr to one of ("NDR", "PDR")
+        # Change the data type from ndrpdr to one of ("NDR", "PDR", "Latency")
         if test_type == "ndrpdr":
             tmp_df = tmp_df.assign(test_type=itm["ttype"].lower())
 
         if not tmp_df.empty:
+            if normalize:
+                if itm["ttype"] == "Latency":
+                    norm_factor = C.FREQUENCY[itm["tbed"]] / C.NORM_FREQUENCY
+                else:
+                    norm_factor = C.NORM_FREQUENCY / C.FREQUENCY[itm["tbed"]]
+            else:
+                norm_factor = 1.0
             tmp_df = _calculate_statistics(
                 tmp_df,
                 itm["ttype"].lower(),
                 itm["driver"],
-                C.NORM_FREQUENCY / C.FREQUENCY[itm["tbed"]] if normalize else 1
+                norm_factor
             )
 
         lst_df.append(tmp_df)
@@ -194,12 +208,15 @@ def comparison_table(
                     })
         return selection
 
-    unit_factor, s_unit_factor = (1e6, "M") if format == "html" else (1, str())
-
     r_sel = deepcopy(selected["reference"]["selection"])
     c_params = selected["compare"]
     r_selection = _create_selection(r_sel)
 
+    if format == "html" and "Latency" not in r_sel["ttype"]:
+        unit_factor, s_unit_factor = (1e6, "M")
+    else:
+        unit_factor, s_unit_factor = (1, str())
+
     # Create Table title and titles of columns with data
     params = list(r_sel)
     params.remove(c_params["parameter"])
index 1397179..e9304b6 100644 (file)
@@ -216,6 +216,7 @@ class Constants:
         "ndr": "result_ndr_lower_rate_value",
         "pdr": "result_pdr_lower_rate_value",
         "pdr-lat": "result_latency_forward_pdr_50_avg",
+        "latency": "result_latency_forward_pdr_50_avg",
         "hoststack-cps": "result_rate_value",
         "hoststack-rps": "result_rate_value",
         "hoststack-bps": "result_bandwidth_value",
@@ -227,6 +228,7 @@ class Constants:
         "ndr": "result_ndr_lower_rate_unit",
         "pdr": "result_pdr_lower_rate_unit",
         "pdr-lat": "result_latency_forward_pdr_50_unit",
+        "latency": "result_latency_forward_pdr_50_unit",
         "hoststack-cps": "result_rate_unit",
         "hoststack-rps": "result_rate_unit",
         "hoststack-bps": "result_bandwidth_unit",