From d07c3c116766c566706767973fc3c3a94ce8b28c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 7 Apr 2020 16:36:31 +0200 Subject: seperate export_facts into print_facts and print_common_facts --- src/plots.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plots.py b/src/plots.py index 3228e5b..9bcc43f 100644 --- a/src/plots.py +++ b/src/plots.py @@ -355,19 +355,28 @@ def plot(bench, plot_options, fig_options) +def print_common_facts(comment_symbol="", file=None): + print(comment_symbol, "Common facts:", file=file) + for fact, value in src.facter.FACTS.items(): + print(f"{comment_symbol} {fact}: {value}", file=file) + print(file=file) -def export_facts_to_file(bench, comment_symbol, output_file): +def print_facts(bench, comment_symbol="", print_common=True, print_allocators=False, file=None): """Write collected facts about used system and benchmark to file""" - print(comment_symbol, bench.name, file=output_file) - print(file=output_file) - print(comment_symbol, "Common facts:", file=output_file) - for fact, value in src.facter.FACTS.items(): - print("f{comment_symbol} {fact}: {value}", file=output_file) - print(file=output_file) - print(comment_symbol, "Benchmark facts:", file=output_file) + print(comment_symbol, bench.name, file=file) + print(file=file) + + if print_common: + print_common_facts(comment_symbol=comment_symbol, file=file) + + print(comment_symbol, "Benchmark facts:", file=file) for fact, value in bench.results["facts"].items(): - print(f"{comment_symbol} {fact}: {value}", file=output_file) - print(file=output_file) + print(comment_symbol, f"{fact}: {value}", file=file) + + if print_allocators: + print(comment_symbol, f'allocators: {" ".join(bench.results["allocators"])}', file=file) + + print(file=file) def export_stats_to_csv(bench, datapoint, path=None): @@ -439,7 +448,7 @@ def export_stats_to_dataref(bench, datapoint, path=None): with open(path, "w") as dataref_file: # Write facts to file - export_facts_to_file(bench, "%", dataref_file) + print_facts(bench, comment_symbol="%", file=dataref_file) for alloc in bench.results["allocators"]: for perm in bench.iterate_args(args=bench.results["args"]): -- cgit v1.2.3