aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-02-09 12:57:49 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-02-09 12:57:49 +0100
commitbf565bf4342a08611d3b3405188352487cb0d211 (patch)
tree8783ab84939e79cfcfe6da04d350b988d6b62599
parent08f920351884a4dfaffa4eb7423cce04374b9958 (diff)
downloadallocbench-bf565bf4342a08611d3b3405188352487cb0d211.tar.gz
allocbench-bf565bf4342a08611d3b3405188352487cb0d211.zip
only create txt trace file if we export to txt
-rwxr-xr-xsrc/chattyparser.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/chattyparser.py b/src/chattyparser.py
index 2cbd974..c28bb3f 100755
--- a/src/chattyparser.py
+++ b/src/chattyparser.py
@@ -214,7 +214,10 @@ def parse(path="chattymalloc.txt",
# Dictionary mapping cache lines to their owning TIDs
context["cache_lines"] = {}
- with open(path, "rb") as trace_file, open(path+".txt", "w") as plain_file:
+ if EXPORT_TXT:
+ plain_file = open(path+".txt", "w")
+
+ with open(path, "rb") as trace_file:
total_entries = os.stat(trace_file.fileno()).st_size // Trace.size
update_interval = int(total_entries * 0.0005)
@@ -248,6 +251,8 @@ def parse(path="chattymalloc.txt",
entry = trace_file.read(Trace.size)
print(f"\r[{i} / {total_entries}] {(i / total_entries) * 100:.2f}% parsed ...")
+ if EXPORT_TXT:
+ plain_file.close()
return context