|
@@ -9,8 +9,8 @@ import utils
|
|
|
|
|
|
# pylint: disable=I0011,W0141
|
|
|
|
|
|
-COLOR_SCHEME_MIN_COLOR = (36, 255, 106)
|
|
|
-COLOR_SCHEME_MAX_COLOR = (216, 33, 0)
|
|
|
+COLOR_SCHEME_MAX_COLOR = (36, 255, 106)
|
|
|
+COLOR_SCHEME_MIN_COLOR = (216, 33, 0)
|
|
|
|
|
|
LATEX_HEADER = r"""\documentclass[12pt,a4paper,onecolumn,openright]{report}
|
|
|
\usepackage[landscape]{geometry}
|
|
@@ -77,9 +77,11 @@ def assemble_latex_chart(optimization_levels, color_defs, test_names, data):
|
|
|
lines.append(LATEX_DOCUMENT_FOOTER)
|
|
|
return '\n'.join(lines)
|
|
|
|
|
|
-def create_latex_chart(perf_data):
|
|
|
+def create_latex_chart(perf_data, sorted_opt_levels=None):
|
|
|
"""Creates a LaTeX chart for the given performance data."""
|
|
|
- sorted_opt_levels = sort_by_runtime(perf_data)
|
|
|
+ if sorted_opt_levels is None:
|
|
|
+ sorted_opt_levels = sort_by_runtime(perf_data)
|
|
|
+
|
|
|
color_scheme = generate_color_scheme(sorted_opt_levels)
|
|
|
opt_levels = []
|
|
|
color_defs = []
|
|
@@ -161,7 +163,7 @@ def sort_by_runtime(perf_data):
|
|
|
relative_perf = get_relative_measurements(perf_data, baseline_opt_level)
|
|
|
# Sort the optimization levels by their mean runtimes.
|
|
|
mean_runtimes = get_mean_runtimes(relative_perf)
|
|
|
- return list(sorted(mean_runtimes.keys(), key=lambda opt_level: mean_runtimes[opt_level]))
|
|
|
+ return list(sorted(mean_runtimes.keys(), key=lambda opt_level: mean_runtimes[opt_level], reverse=True))
|
|
|
|
|
|
def generate_color_scheme(sorted_opt_levels):
|
|
|
"""Assigns a color to every optimization level in the given performance data."""
|
|
@@ -200,6 +202,7 @@ def main():
|
|
|
args = arg_parser.parse_args()
|
|
|
|
|
|
perf_data = utils.parse_perf_data(args.input)[args.quantity]
|
|
|
+ sorted_opt_levels = None
|
|
|
|
|
|
if args.opt:
|
|
|
optimization_set = set(args.opt)
|
|
@@ -207,6 +210,7 @@ def main():
|
|
|
(optimization_level, measurements)
|
|
|
for optimization_level, measurements in perf_data
|
|
|
if optimization_level in optimization_set]
|
|
|
+ sorted_opt_levels = list(args.opt)
|
|
|
|
|
|
if args.test:
|
|
|
test_set = set(args.test)
|
|
@@ -227,7 +231,7 @@ def main():
|
|
|
baseline_opt_level = get_baseline_optimization_level(perf_data_dict)
|
|
|
perf_data_dict = get_relative_measurements(perf_data_dict, baseline_opt_level)
|
|
|
|
|
|
- print(create_latex_chart(perf_data_dict))
|
|
|
+ print(create_latex_chart(perf_data_dict, sorted_opt_levels))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
main()
|