- columnwidth=params[u"width"][idx],
- header=table_header,
- cells=dict(
- values=[df_sorted.get(col) for col in header],
- fill_color=fill_color,
- align=params[u"align-itm"][idx],
- font=dict(
- family=u"Courier New",
- size=12
- )
- )
- )
- )
-
- ploff.plot(
- fig,
- show_link=False,
- auto_open=False,
- filename=f"{out_file_name}_in.html"
- )
-
- file_name = out_file_name.split(u"/")[-1]
- if u"vpp" in out_file_name:
- path = u"_tmp/src/vpp_performance_tests/comparisons/"
- else:
- path = u"_tmp/src/dpdk_performance_tests/comparisons/"
- with open(f"{path}{file_name}.rst", u"wt") as rst_file:
- rst_file.write(
- u"\n"
- u".. |br| raw:: html\n\n <br />\n\n\n"
- u".. |prein| raw:: html\n\n <pre>\n\n\n"
- u".. |preout| raw:: html\n\n </pre>\n\n"
- )
- if title:
- rst_file.write(f"{title}\n")
- rst_file.write(f"{u'`' * len(title)}\n\n")
- rst_file.write(
- u".. raw:: html\n\n"
- f' <iframe frameborder="0" scrolling="no" '
- f'width="1600" height="1200" '
- f'src="../..{out_file_name.replace(u"_build", u"")}_in.html">'
- f'</iframe>\n\n'
- )
- if legend:
- rst_file.write(legend[1:].replace(u"\n", u" |br| "))
- if footnote:
- rst_file.write(footnote.replace(u"\n", u" |br| ")[1:])
-
-
-def table_perf_comparison(table, input_data):
- """Generate the table(s) with algorithm: table_perf_comparison
- specified in the specification file.
-
- :param table: Table to generate.
- :param input_data: Data to process.
- :type table: pandas.Series
- :type input_data: InputData
- """
-
- logging.info(f" Generating the table {table.get(u'title', u'')} ...")
-
- # Transform the data
- logging.info(
- f" Creating the data set for the {table.get(u'type', u'')} "
- f"{table.get(u'title', u'')}."
- )
- data = input_data.filter_data(table, continue_on_error=True)
-
- # Prepare the header of the tables
- try:
- header = [u"Test Case", ]
- legend = u"\nLegend:\n"
-
- rca_data = None
- rca = table.get(u"rca", None)
- if rca:
- try:
- with open(rca.get(u"data-file", u""), u"r") as rca_file:
- rca_data = load(rca_file, Loader=FullLoader)
- header.insert(0, rca.get(u"title", u"RCA"))
- legend += (
- u"RCA: Reference to the Root Cause Analysis, see below.\n"
- )
- except (YAMLError, IOError) as err:
- logging.warning(repr(err))
-
- history = table.get(u"history", list())
- for item in history:
- header.extend(
- [
- f"{item[u'title']} Avg({table[u'include-tests']})",
- f"{item[u'title']} Stdev({table[u'include-tests']})"
- ]
- )
- legend += (
- f"{item[u'title']} Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from "
- f"a series of runs of the listed tests executed against "
- f"{item[u'title']}.\n"
- f"{item[u'title']} Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {item[u'title']}.\n"
- )
- header.extend(
- [
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']})",
- u"Stdev(Diff)"
- ]
- )
- header_str = u";".join(header) + u"\n"
- legend += (
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed against "
- f"{table[u'reference'][u'title']}.\n"
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {table[u'reference'][u'title']}.\n"
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed against "
- f"{table[u'compare'][u'title']}.\n"
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {table[u'compare'][u'title']}.\n"
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']}): "
- f"Percentage change calculated for mean values.\n"
- u"Stdev(Diff): "
- u"Standard deviation of percentage change calculated for mean "
- u"values.\n"
- u"NT: Not Tested\n"
- )
- except (AttributeError, KeyError) as err:
- logging.error(f"The model is invalid, missing parameter: {repr(err)}")
- return
-
- # Prepare data to the table:
- tbl_dict = dict()
- for job, builds in table[u"reference"][u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- tst_name_mod = _tpc_modify_test_name(tst_name)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": True,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- _tpc_insert_data(target=tbl_dict[tst_name_mod][u"ref-data"],
- src=tst_data,
- include_tests=table[u"include-tests"])
-
- replacement = table[u"reference"].get(u"data-replacement", None)
- if replacement:
- rpl_data = input_data.filter_data(
- table, data=replacement, continue_on_error=True)
- for job, builds in replacement.items():
- for build in builds:
- for tst_name, tst_data in rpl_data[job][str(build)].items():
- tst_name_mod = _tpc_modify_test_name(tst_name)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- if tbl_dict[tst_name_mod][u"replace-ref"]:
- tbl_dict[tst_name_mod][u"replace-ref"] = False
- tbl_dict[tst_name_mod][u"ref-data"] = list()
-
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"ref-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- for job, builds in table[u"compare"][u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- tst_name_mod = _tpc_modify_test_name(tst_name)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"cmp-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- replacement = table[u"compare"].get(u"data-replacement", None)
- if replacement:
- rpl_data = input_data.filter_data(
- table, data=replacement, continue_on_error=True)
- for job, builds in replacement.items():
- for build in builds:
- for tst_name, tst_data in rpl_data[job][str(build)].items():
- tst_name_mod = _tpc_modify_test_name(tst_name)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": False,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- if tbl_dict[tst_name_mod][u"replace-cmp"]:
- tbl_dict[tst_name_mod][u"replace-cmp"] = False
- tbl_dict[tst_name_mod][u"cmp-data"] = list()
-
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"cmp-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- for item in history:
- for job, builds in item[u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- tst_name_mod = _tpc_modify_test_name(tst_name)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- continue
- if tbl_dict[tst_name_mod].get(u"history", None) is None:
- tbl_dict[tst_name_mod][u"history"] = OrderedDict()
- if tbl_dict[tst_name_mod][u"history"].\
- get(item[u"title"], None) is None:
- tbl_dict[tst_name_mod][u"history"][item[
- u"title"]] = list()
- try:
- if table[u"include-tests"] == u"MRR":
- res = (tst_data[u"result"][u"receive-rate"],
- tst_data[u"result"][u"receive-stdev"])
- elif table[u"include-tests"] == u"PDR":
- res = tst_data[u"throughput"][u"PDR"][u"LOWER"]
- elif table[u"include-tests"] == u"NDR":
- res = tst_data[u"throughput"][u"NDR"][u"LOWER"]
- else:
- continue
- tbl_dict[tst_name_mod][u"history"][item[u"title"]].\
- append(res)
- except (TypeError, KeyError):
- pass
-
- tbl_lst = list()
- for tst_name in tbl_dict:
- item = [tbl_dict[tst_name][u"name"], ]
- if history:
- if tbl_dict[tst_name].get(u"history", None) is not None:
- for hist_data in tbl_dict[tst_name][u"history"].values():
- if hist_data:
- if table[u"include-tests"] == u"MRR":
- item.append(round(hist_data[0][0] / 1e6, 1))
- item.append(round(hist_data[0][1] / 1e6, 1))
- else:
- item.append(round(mean(hist_data) / 1e6, 1))
- item.append(round(stdev(hist_data) / 1e6, 1))
- else:
- item.extend([u"NT", u"NT"])
- else:
- item.extend([u"NT", u"NT"])
- data_r = tbl_dict[tst_name][u"ref-data"]
- if data_r:
- if table[u"include-tests"] == u"MRR":
- data_r_mean = data_r[0][0]
- data_r_stdev = data_r[0][1]
- else:
- data_r_mean = mean(data_r)
- data_r_stdev = stdev(data_r)
- item.append(round(data_r_mean / 1e6, 1))
- item.append(round(data_r_stdev / 1e6, 1))
- else:
- data_r_mean = None
- data_r_stdev = None
- item.extend([u"NT", u"NT"])
- data_c = tbl_dict[tst_name][u"cmp-data"]
- if data_c:
- if table[u"include-tests"] == u"MRR":
- data_c_mean = data_c[0][0]
- data_c_stdev = data_c[0][1]
- else:
- data_c_mean = mean(data_c)
- data_c_stdev = stdev(data_c)
- item.append(round(data_c_mean / 1e6, 1))
- item.append(round(data_c_stdev / 1e6, 1))
- else:
- data_c_mean = None
- data_c_stdev = None
- item.extend([u"NT", u"NT"])
- if item[-2] == u"NT":
- pass
- elif item[-4] == u"NT":
- item.append(u"New in CSIT-2001")
- item.append(u"New in CSIT-2001")
- elif data_r_mean is not None and data_c_mean is not None:
- delta, d_stdev = relative_change_stdev(
- data_r_mean, data_c_mean, data_r_stdev, data_c_stdev
- )
- try:
- item.append(round(delta))
- except ValueError:
- item.append(delta)
- try:
- item.append(round(d_stdev))
- except ValueError:
- item.append(d_stdev)
- if rca_data:
- rca_nr = rca_data.get(item[0], u"-")
- item.insert(0, f"[{rca_nr}]" if rca_nr != u"-" else u"-")
- if (len(item) == len(header)) and (item[-4] != u"NT"):
- tbl_lst.append(item)
-
- tbl_lst = _tpc_sort_table(tbl_lst)
-
- # Generate csv tables:
- csv_file = f"{table[u'output-file']}.csv"
- with open(csv_file, u"wt") as file_handler:
- file_handler.write(header_str)
- for test in tbl_lst:
- file_handler.write(u";".join([str(item) for item in test]) + u"\n")
-
- txt_file_name = f"{table[u'output-file']}.txt"
- convert_csv_to_pretty_txt(csv_file, txt_file_name, delimiter=u";")
-
- footnote = u""
- with open(txt_file_name, u'a') as txt_file:
- txt_file.write(legend)
- if rca_data:
- footnote = rca_data.get(u"footnote", u"")
- if footnote:
- txt_file.write(f"\n{footnote}")
- txt_file.write(u"\n:END")
-
- # Generate html table:
- _tpc_generate_html_table(
- header,
- tbl_lst,
- table[u'output-file'],
- legend=legend,
- footnote=footnote,
- title=table.get(u"title", u"")
- )
-
-
-def table_perf_comparison_nic(table, input_data):
- """Generate the table(s) with algorithm: table_perf_comparison
- specified in the specification file.
-
- :param table: Table to generate.
- :param input_data: Data to process.
- :type table: pandas.Series
- :type input_data: InputData
- """
-
- logging.info(f" Generating the table {table.get(u'title', u'')} ...")
-
- # Transform the data
- logging.info(
- f" Creating the data set for the {table.get(u'type', u'')} "
- f"{table.get(u'title', u'')}."
- )
- data = input_data.filter_data(table, continue_on_error=True)
-
- # Prepare the header of the tables
- try:
- header = [u"Test Case", ]
- legend = u"\nLegend:\n"
-
- rca_data = None
- rca = table.get(u"rca", None)
- if rca:
- try:
- with open(rca.get(u"data-file", ""), u"r") as rca_file:
- rca_data = load(rca_file, Loader=FullLoader)
- header.insert(0, rca.get(u"title", "RCA"))
- legend += (
- u"RCA: Reference to the Root Cause Analysis, see below.\n"
- )
- except (YAMLError, IOError) as err:
- logging.warning(repr(err))
-
- history = table.get(u"history", list())
- for item in history:
- header.extend(
- [
- f"{item[u'title']} Avg({table[u'include-tests']})",
- f"{item[u'title']} Stdev({table[u'include-tests']})"
- ]
- )
- legend += (
- f"{item[u'title']} Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from "
- f"a series of runs of the listed tests executed against "
- f"{item[u'title']}.\n"
- f"{item[u'title']} Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {item[u'title']}.\n"
- )
- header.extend(
- [
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']})",
- u"Stdev(Diff)"
- ]
- )
- header_str = u";".join(header) + u"\n"
- legend += (
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed against "
- f"{table[u'reference'][u'title']}.\n"
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {table[u'reference'][u'title']}.\n"
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed against "
- f"{table[u'compare'][u'title']}.\n"
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"against {table[u'compare'][u'title']}.\n"
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']}): "
- f"Percentage change calculated for mean values.\n"
- u"Stdev(Diff): "
- u"Standard deviation of percentage change calculated for mean "
- u"values.\n"
- u"NT: Not Tested\n"
- )
- except (AttributeError, KeyError) as err:
- logging.error(f"The model is invalid, missing parameter: {repr(err)}")
- return
-
- # Prepare data to the table:
- tbl_dict = dict()
- for job, builds in table[u"reference"][u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- if table[u"reference"][u"nic"] not in tst_data[u"tags"]:
- continue
- tst_name_mod = _tpc_modify_test_name(tst_name, ignore_nic=True)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": True,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"ref-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- replacement = table[u"reference"].get(u"data-replacement", None)
- if replacement:
- rpl_data = input_data.filter_data(
- table, data=replacement, continue_on_error=True)
- for job, builds in replacement.items():
- for build in builds:
- for tst_name, tst_data in rpl_data[job][str(build)].items():
- if table[u"reference"][u"nic"] not in tst_data[u"tags"]:
- continue
- tst_name_mod = \
- _tpc_modify_test_name(tst_name, ignore_nic=True)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- if tbl_dict[tst_name_mod][u"replace-ref"]:
- tbl_dict[tst_name_mod][u"replace-ref"] = False
- tbl_dict[tst_name_mod][u"ref-data"] = list()
-
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"ref-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- for job, builds in table[u"compare"][u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- if table[u"compare"][u"nic"] not in tst_data[u"tags"]:
- continue
- tst_name_mod = _tpc_modify_test_name(tst_name, ignore_nic=True)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": True,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"cmp-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- replacement = table[u"compare"].get(u"data-replacement", None)
- if replacement:
- rpl_data = input_data.filter_data(
- table, data=replacement, continue_on_error=True)
- for job, builds in replacement.items():
- for build in builds:
- for tst_name, tst_data in rpl_data[job][str(build)].items():
- if table[u"compare"][u"nic"] not in tst_data[u"tags"]:
- continue
- tst_name_mod = \
- _tpc_modify_test_name(tst_name, ignore_nic=True)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- name = tst_data[u'name'].rsplit(u'-', 1)[0]
- if u"across testbeds" in table[u"title"].lower() or \
- u"across topologies" in table[u"title"].lower():
- name = _tpc_modify_displayed_test_name(name)
- tbl_dict[tst_name_mod] = {
- u"name": name,
- u"replace-ref": False,
- u"replace-cmp": False,
- u"ref-data": list(),
- u"cmp-data": list()
- }
- if tbl_dict[tst_name_mod][u"replace-cmp"]:
- tbl_dict[tst_name_mod][u"replace-cmp"] = False
- tbl_dict[tst_name_mod][u"cmp-data"] = list()
-
- _tpc_insert_data(
- target=tbl_dict[tst_name_mod][u"cmp-data"],
- src=tst_data,
- include_tests=table[u"include-tests"]
- )
-
- for item in history:
- for job, builds in item[u"data"].items():
- for build in builds:
- for tst_name, tst_data in data[job][str(build)].items():
- if item[u"nic"] not in tst_data[u"tags"]:
- continue
- tst_name_mod = \
- _tpc_modify_test_name(tst_name, ignore_nic=True)
- if (u"across topologies" in table[u"title"].lower() or
- (u" 3n-" in table[u"title"].lower() and
- u" 2n-" in table[u"title"].lower())):
- tst_name_mod = tst_name_mod.replace(u"2n1l-", u"")
- if tbl_dict.get(tst_name_mod, None) is None:
- continue
- if tbl_dict[tst_name_mod].get(u"history", None) is None:
- tbl_dict[tst_name_mod][u"history"] = OrderedDict()
- if tbl_dict[tst_name_mod][u"history"].\
- get(item[u"title"], None) is None:
- tbl_dict[tst_name_mod][u"history"][item[
- u"title"]] = list()
- try:
- if table[u"include-tests"] == u"MRR":
- res = (tst_data[u"result"][u"receive-rate"],
- tst_data[u"result"][u"receive-stdev"])
- elif table[u"include-tests"] == u"PDR":
- res = tst_data[u"throughput"][u"PDR"][u"LOWER"]
- elif table[u"include-tests"] == u"NDR":
- res = tst_data[u"throughput"][u"NDR"][u"LOWER"]
- else:
- continue
- tbl_dict[tst_name_mod][u"history"][item[u"title"]].\
- append(res)
- except (TypeError, KeyError):
- pass
-
- tbl_lst = list()
- for tst_name in tbl_dict:
- item = [tbl_dict[tst_name][u"name"], ]
- if history:
- if tbl_dict[tst_name].get(u"history", None) is not None:
- for hist_data in tbl_dict[tst_name][u"history"].values():
- if hist_data:
- if table[u"include-tests"] == u"MRR":
- item.append(round(hist_data[0][0] / 1e6, 1))
- item.append(round(hist_data[0][1] / 1e6, 1))
- else:
- item.append(round(mean(hist_data) / 1e6, 1))
- item.append(round(stdev(hist_data) / 1e6, 1))
- else:
- item.extend([u"NT", u"NT"])
- else:
- item.extend([u"NT", u"NT"])
- data_r = tbl_dict[tst_name][u"ref-data"]
- if data_r:
- if table[u"include-tests"] == u"MRR":
- data_r_mean = data_r[0][0]
- data_r_stdev = data_r[0][1]
- else:
- data_r_mean = mean(data_r)
- data_r_stdev = stdev(data_r)
- item.append(round(data_r_mean / 1e6, 1))
- item.append(round(data_r_stdev / 1e6, 1))
- else:
- data_r_mean = None
- data_r_stdev = None
- item.extend([u"NT", u"NT"])
- data_c = tbl_dict[tst_name][u"cmp-data"]
- if data_c:
- if table[u"include-tests"] == u"MRR":
- data_c_mean = data_c[0][0]
- data_c_stdev = data_c[0][1]
- else:
- data_c_mean = mean(data_c)
- data_c_stdev = stdev(data_c)
- item.append(round(data_c_mean / 1e6, 1))
- item.append(round(data_c_stdev / 1e6, 1))
- else:
- data_c_mean = None
- data_c_stdev = None
- item.extend([u"NT", u"NT"])
- if item[-2] == u"NT":
- pass
- elif item[-4] == u"NT":
- item.append(u"New in CSIT-2001")
- item.append(u"New in CSIT-2001")
- elif data_r_mean is not None and data_c_mean is not None:
- delta, d_stdev = relative_change_stdev(
- data_r_mean, data_c_mean, data_r_stdev, data_c_stdev
- )
- try:
- item.append(round(delta))
- except ValueError:
- item.append(delta)
- try:
- item.append(round(d_stdev))
- except ValueError:
- item.append(d_stdev)
- if rca_data:
- rca_nr = rca_data.get(item[0], u"-")
- item.insert(0, f"[{rca_nr}]" if rca_nr != u"-" else u"-")
- if (len(item) == len(header)) and (item[-4] != u"NT"):
- tbl_lst.append(item)
-
- tbl_lst = _tpc_sort_table(tbl_lst)
-
- # Generate csv tables:
- csv_file = f"{table[u'output-file']}.csv"
- with open(csv_file, u"wt") as file_handler:
- file_handler.write(header_str)
- for test in tbl_lst:
- file_handler.write(u";".join([str(item) for item in test]) + u"\n")
-
- txt_file_name = f"{table[u'output-file']}.txt"
- convert_csv_to_pretty_txt(csv_file, txt_file_name, delimiter=u";")
-
- footnote = u""
- with open(txt_file_name, u'a') as txt_file:
- txt_file.write(legend)
- if rca_data:
- footnote = rca_data.get(u"footnote", u"")
- if footnote:
- txt_file.write(f"\n{footnote}")
- txt_file.write(u"\n:END")
-
- # Generate html table:
- _tpc_generate_html_table(
- header,
- tbl_lst,
- table[u'output-file'],
- legend=legend,
- footnote=footnote,
- title=table.get(u"title", u"")
- )
-
-
-def table_nics_comparison(table, input_data):
- """Generate the table(s) with algorithm: table_nics_comparison
- specified in the specification file.
-
- :param table: Table to generate.
- :param input_data: Data to process.
- :type table: pandas.Series
- :type input_data: InputData
- """
-
- logging.info(f" Generating the table {table.get(u'title', u'')} ...")
-
- # Transform the data
- logging.info(
- f" Creating the data set for the {table.get(u'type', u'')} "
- f"{table.get(u'title', u'')}."
- )
- data = input_data.filter_data(table, continue_on_error=True)
-
- # Prepare the header of the tables
- try:
- header = [
- u"Test Case",
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']})",
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']})",
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']})",
- u"Stdev(Diff)"
- ]
- legend = (
- u"\nLegend:\n"
- f"{table[u'reference'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed using "
- f"{table[u'reference'][u'title']} NIC.\n"
- f"{table[u'reference'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"using {table[u'reference'][u'title']} NIC.\n"
- f"{table[u'compare'][u'title']} "
- f"Avg({table[u'include-tests']}): "
- f"Mean value of {table[u'include-tests']} [Mpps] computed from a "
- f"series of runs of the listed tests executed using "
- f"{table[u'compare'][u'title']} NIC.\n"
- f"{table[u'compare'][u'title']} "
- f"Stdev({table[u'include-tests']}): "
- f"Standard deviation value of {table[u'include-tests']} [Mpps] "
- f"computed from a series of runs of the listed tests executed "
- f"using {table[u'compare'][u'title']} NIC.\n"
- f"Diff({table[u'reference'][u'title']},"
- f"{table[u'compare'][u'title']}): "
- f"Percentage change calculated for mean values.\n"
- u"Stdev(Diff): "
- u"Standard deviation of percentage change calculated for mean "
- u"values.\n"
- u":END"