aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/generator_tables.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-06-25 13:56:43 +0200
committerTibor Frank <tifrank@cisco.com>2021-06-28 10:22:43 +0000
commit7b4dc49521908774f9eb2f5d287078cce06d8e49 (patch)
tree13c80339eb55bab95fa307ce56e1a9c7c8821105 /resources/tools/presentation/generator_tables.py
parentc969f0ba092c4cd9b9115f414cd32442675a006f (diff)
PAL: Process sh-run from telemetry
Change-Id: Ia1a3427609b284d0036dfe3b2ffbb17a9b4f8a65 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/generator_tables.py')
-rw-r--r--resources/tools/presentation/generator_tables.py68
1 files changed, 35 insertions, 33 deletions
diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py
index 8218084f71..5b95189029 100644
--- a/resources/tools/presentation/generator_tables.py
+++ b/resources/tools/presentation/generator_tables.py
@@ -94,7 +94,7 @@ def table_oper_data_html(table, input_data):
)
data = input_data.filter_data(
table,
- params=[u"name", u"parent", u"show-run", u"type"],
+ params=[u"name", u"parent", u"telemetry-show-run", u"type"],
continue_on_error=True
)
if data.empty:
@@ -147,7 +147,8 @@ def table_oper_data_html(table, input_data):
)
thead.text = u"\t"
- if tst_data.get(u"show-run", u"No Data") == u"No Data":
+ if tst_data.get(u"telemetry-show-run", None) is None or \
+ isinstance(tst_data[u"telemetry-show-run"], str):
trow = ET.SubElement(
tbl, u"tr", attrib=dict(bgcolor=colors[u"header"])
)
@@ -177,7 +178,7 @@ def table_oper_data_html(table, input_data):
u"Average Vector Size"
)
- for dut_data in tst_data[u"show-run"].values():
+ for dut_data in tst_data[u"telemetry-show-run"].values():
trow = ET.SubElement(
tbl, u"tr", attrib=dict(bgcolor=colors[u"header"])
)
@@ -188,39 +189,41 @@ def table_oper_data_html(table, input_data):
tcol.text = u"No Data"
continue
- runtime = loads(dut_data[u"runtime"])
-
- try:
- threads_nr = len(runtime[0][u"clocks"])
- except (IndexError, KeyError):
- tcol.text = u"No Data"
- continue
-
- threads = OrderedDict({idx: list() for idx in range(threads_nr)})
- for item in runtime:
- for idx in range(threads_nr):
- if item[u"vectors"][idx] > 0:
- clocks = item[u"clocks"][idx] / item[u"vectors"][idx]
- elif item[u"calls"][idx] > 0:
- clocks = item[u"clocks"][idx] / item[u"calls"][idx]
- elif item[u"suspends"][idx] > 0:
- clocks = item[u"clocks"][idx] / item[u"suspends"][idx]
+ runtime = dict()
+ for item in dut_data[u"runtime"].get(u"data", tuple()):
+ tid = int(item[u"labels"][u"thread_id"])
+ if runtime.get(tid, None) is None:
+ runtime[tid] = dict()
+ gnode = item[u"labels"][u"graph_node"]
+ if runtime[tid].get(gnode, None) is None:
+ runtime[tid][gnode] = dict()
+ try:
+ runtime[tid][gnode][item[u"name"]] = float(item[u"value"])
+ except ValueError:
+ runtime[tid][gnode][item[u"name"]] = item[u"value"]
+
+ threads = dict({idx: list() for idx in range(len(runtime))})
+ for idx, run_data in runtime.items():
+ for gnode, gdata in run_data.items():
+ if gdata[u"vectors"] > 0:
+ clocks = gdata[u"clocks"] / gdata[u"vectors"]
+ elif gdata[u"calls"] > 0:
+ clocks = gdata[u"clocks"] / gdata[u"calls"]
+ elif gdata[u"suspends"] > 0:
+ clocks = gdata[u"clocks"] / gdata[u"suspends"]
else:
clocks = 0.0
-
- if item[u"calls"][idx] > 0:
- vectors_call = item[u"vectors"][idx] / item[u"calls"][
- idx]
+ if gdata[u"calls"] > 0:
+ vectors_call = gdata[u"vectors"] / gdata[u"calls"]
else:
vectors_call = 0.0
-
- if int(item[u"calls"][idx]) + int(item[u"vectors"][idx]) + \
- int(item[u"suspends"][idx]):
+ if int(gdata[u"calls"]) + int(gdata[u"vectors"]) + \
+ int(gdata[u"suspends"]):
threads[idx].append([
- item[u"name"],
- item[u"calls"][idx],
- item[u"vectors"][idx],
- item[u"suspends"][idx],
+ gnode,
+ int(gdata[u"calls"]),
+ int(gdata[u"vectors"]),
+ int(gdata[u"suspends"]),
clocks,
vectors_call
])
@@ -393,8 +396,7 @@ def table_merged_details(table, input_data):
col_data = col_data.replace(u'\n', u' |br| ').\
replace(u'\r', u'').replace(u'"', u"'")
col_data = f" |prein| {col_data} |preout| "
- elif column[u"data"].split(u" ")[1] in \
- (u"conf-history", u"show-run"):
+ elif column[u"data"].split(u" ")[1] in (u"conf-history", ):
col_data = col_data.replace(u'\n', u' |br| ')
col_data = f" |prein| {col_data[:-5]} |preout| "
row_lst.append(f'"{col_data}"')