- lat = [int(item) for item in str(groups.group(idx)).split('/')]
- except (AttributeError, ValueError):
- lat = [-1, -1, -1]
- latencies.append(lat)
-
- keys = ("min", "avg", "max")
- latency = {
- "direction1": {
- },
- "direction2": {
- }
- }
-
- latency["direction1"]["100"] = dict(zip(keys, latencies[0]))
- latency["direction2"]["100"] = dict(zip(keys, latencies[1]))
- if test_type == "NDR":
- latency["direction1"]["50"] = dict(zip(keys, latencies[2]))
- latency["direction2"]["50"] = dict(zip(keys, latencies[3]))
- latency["direction1"]["10"] = dict(zip(keys, latencies[4]))
- latency["direction2"]["10"] = dict(zip(keys, latencies[5]))
-
- return latency
+ threads_nr = len(runtime[0]["clocks"])
+ except (IndexError, KeyError):
+ return
+ tbl_hdr = ["Name", "Calls", "Vectors", "Suspends", "Clocks",
+ "Vectors/Calls"]
+ table = [[tbl_hdr, ] for _ in range(threads_nr)]
+ for item in runtime:
+ for idx in range(threads_nr):
+ name = format(item["name"])
+ calls = format(item["calls"][idx])
+ vectors = format(item["vectors"][idx])
+ suspends = format(item["suspends"][idx])
+ if item["vectors"][idx] > 0:
+ clocks = format(
+ item["clocks"][idx]/item["vectors"][idx], ".2e")
+ elif item["calls"][idx] > 0:
+ clocks = format(
+ item["clocks"][idx]/item["calls"][idx], ".2e")
+ elif item["suspends"][idx] > 0:
+ clocks = format(
+ item["clocks"][idx]/item["suspends"][idx], ".2e")
+ else:
+ clocks = 0
+ if item["calls"][idx] > 0:
+ vectors_call = format(
+ item["vectors"][idx]/item["calls"][idx], ".2f")
+ else:
+ vectors_call = format(0, ".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 += "Thread {idx} ".format(idx=idx)
+ text += "vpp_main\n" if idx == 0 else \
+ "vpp_wk_{idx}\n".format(idx=idx-1)
+ 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["Name"] = "l"
+ txt_table.align["Calls"] = "r"
+ txt_table.align["Vectors"] = "r"
+ txt_table.align["Suspends"] = "r"
+ txt_table.align["Clocks"] = "r"
+ txt_table.align["Vectors/Calls"] = "r"
+
+ text += txt_table.get_string(sortby="Name") + '\n'
+ text = (" \n **DUT: {host}/{socket}** \n {text}".
+ format(host=host, socket=socket, text=text))
+ text = text.replace('\n', ' |br| ').replace('\r', '').\
+ replace('"', "'")
+ self._data["tests"][self._test_ID]["show-run"] += text