From bf565bf4342a08611d3b3405188352487cb0d211 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 9 Feb 2020 12:57:49 +0100 Subject: only create txt trace file if we export to txt --- src/chattyparser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3