aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/generator_tables.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-06-21 16:34:23 +0200
committerTibor Frank <tifrank@cisco.com>2021-06-22 08:40:07 +0000
commit733c403c1fefd2472581a17e1fb4e749788639b5 (patch)
tree489240ae456e4200dfc3695e3cb3dd67dedcece1 /resources/tools/presentation/generator_tables.py
parent64683b4952bf98f6db4c534fc793419571a7030a (diff)
JSON: Implement latest changes
Change-Id: Ife5feacad6885427066a5b28978f25965394b557 Signed-off-by: Tibor Frank <tifrank@cisco.com> (cherry picked from commit 36048e330c53b0325fb120da0f7661ad2dd44611)
Diffstat (limited to 'resources/tools/presentation/generator_tables.py')
-rw-r--r--resources/tools/presentation/generator_tables.py39
1 files changed, 37 insertions, 2 deletions
diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py
index bb962890d0..d66a8fc3cf 100644
--- a/resources/tools/presentation/generator_tables.py
+++ b/resources/tools/presentation/generator_tables.py
@@ -183,10 +183,45 @@ def table_oper_data_html(table, input_data):
tcol = ET.SubElement(
trow, u"td", attrib=dict(align=u"left", colspan=u"6")
)
- if dut_data.get(u"threads", None) is None:
+ if dut_data.get(u"runtime", None) is None:
tcol.text = u"No Data"
continue
+ try:
+ threads_nr = len(dut_data[u"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 dut_data[u"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]
+ else:
+ clocks = 0.0
+
+ if item[u"calls"][idx] > 0:
+ vectors_call = item[u"vectors"][idx] / item[u"calls"][
+ idx]
+ else:
+ vectors_call = 0.0
+
+ if int(item[u"calls"][idx]) + int(item[u"vectors"][idx]) + \
+ int(item[u"suspends"][idx]):
+ threads[idx].append([
+ item[u"name"],
+ item[u"calls"][idx],
+ item[u"vectors"][idx],
+ item[u"suspends"][idx],
+ clocks,
+ vectors_call
+ ])
+
bold = ET.SubElement(tcol, u"b")
bold.text = (
f"Host IP: {dut_data.get(u'host', '')}, "
@@ -200,7 +235,7 @@ def table_oper_data_html(table, input_data):
)
thead.text = u"\t"
- for thread_nr, thread in dut_data[u"threads"].items():
+ for thread_nr, thread in threads.items():
trow = ET.SubElement(
tbl, u"tr", attrib=dict(bgcolor=colors[u"header"])
)