+ if msg.message.count(u"stats runtime") or \
+ msg.message.count(u"Runtime"):
+ try:
+ host = str(re.search(self.REGEX_TC_PAPI_CLI, msg.message).
+ group(1))
+ except (AttributeError, IndexError):
+ host = self._data[u"tests"][self._test_id][u"show-run"].\
+ count(u"DUT:") + 1
+ try:
+ socket = str(re.search(self.REGEX_TC_PAPI_CLI, msg.message).
+ group(2))
+ socket = f"/{socket}"
+ except (AttributeError, IndexError):
+ socket = u""
+ runtime = loads(
+ str(msg.message).
+ replace(u' ', u'').
+ replace(u'\n', u'').
+ replace(u"'", u'"').
+ replace(u'b"', u'"').
+ replace(u'u"', u'"').
+ split(u":", 1)[1]
+ )
+ try:
+ threads_nr = len(runtime[0][u"clocks"])
+ except (IndexError, KeyError):
+ return
+ tbl_hdr = [
+ u"Name",
+ u"Calls",
+ u"Vectors",
+ u"Suspends",
+ u"Clocks",
+ u"Vectors/Calls"
+ ]
+ table = [[tbl_hdr, ] for _ in range(threads_nr)]
+ for item in runtime:
+ for idx in range(threads_nr):
+ name = format(item[u"name"])
+ calls = format(item[u"calls"][idx])
+ vectors = format(item[u"vectors"][idx])
+ suspends = format(item[u"suspends"][idx])
+ if item[u"vectors"][idx] > 0:
+ clocks = format(
+ item[u"clocks"][idx]/item[u"vectors"][idx], u".2e")
+ elif item[u"calls"][idx] > 0:
+ clocks = format(
+ item[u"clocks"][idx]/item[u"calls"][idx], u".2e")
+ elif item[u"suspends"][idx] > 0:
+ clocks = format(
+ item[u"clocks"][idx]/item[u"suspends"][idx], u".2e")
+ else:
+ clocks = 0
+ if item[u"calls"][idx] > 0:
+ vectors_call = format(
+ item[u"vectors"][idx]/item[u"calls"][idx], u".2f")
+ else:
+ vectors_call = format(0, u".2f")
+ if int(calls) + int(vectors) + int(suspends):
+ table[idx].append([
+ name, calls, vectors, suspends, clocks, vectors_call
+ ])
+ text = ""
+ for idx in range(threads_nr):
+ text += f"Thread {idx} "
+ text += u"vpp_main\n" if idx == 0 else f"vpp_wk_{idx-1}\n"
+ txt_table = None
+ for row in table[idx]:
+ if txt_table is None:
+ txt_table = prettytable.PrettyTable(row)
+ else:
+ if any(row[1:]):
+ txt_table.add_row(row)
+ txt_table.set_style(prettytable.MSWORD_FRIENDLY)
+ txt_table.align[u"Name"] = u"l"
+ txt_table.align[u"Calls"] = u"r"
+ txt_table.align[u"Vectors"] = u"r"
+ txt_table.align[u"Suspends"] = u"r"
+ txt_table.align[u"Clocks"] = u"r"
+ txt_table.align[u"Vectors/Calls"] = u"r"
+
+ text += txt_table.get_string(sortby=u"Name") + u'\n'
+ text = f"\n**DUT: {host}{socket}**\n{text}".\
+ replace(u'\n', u' |br| ').\
+ replace(u'\r', u'').\
+ replace(u'"', u"'")
+ self._data[u"tests"][self._test_id][u"show-run"] += text
+
+ def _get_ndrpdr_throughput(self, msg):
+ """Get NDR_LOWER, NDR_UPPER, PDR_LOWER and PDR_UPPER from the test
+ message.
+
+ :param msg: The test message to be parsed.