aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-04-07 16:36:31 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-04-07 16:36:31 +0200
commitd07c3c116766c566706767973fc3c3a94ce8b28c (patch)
treed53aefcc530cc1437c7664e3d708c7823a0ffcef
parente6b4c6fdb11234468af08eef059397a67ba1eae9 (diff)
downloadallocbench-d07c3c116766c566706767973fc3c3a94ce8b28c.tar.gz
allocbench-d07c3c116766c566706767973fc3c3a94ce8b28c.zip
seperate export_facts into print_facts and print_common_facts
-rw-r--r--src/plots.py31
1 files changed, 20 insertions, 11 deletions
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"]):