From 36048e330c53b0325fb120da0f7661ad2dd44611 Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Mon, 21 Jun 2021 16:34:23 +0200 Subject: JSON: Implement latest changes Change-Id: Ife5feacad6885427066a5b28978f25965394b557 Signed-off-by: Tibor Frank --- resources/tools/presentation/generator_tables.py | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'resources/tools/presentation/generator_tables.py') 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"]) ) -- cgit 1.2.3-korg