summaryrefslogtreecommitdiff
path: root/progress.py
diff options
context:
space:
mode:
authorEthan Roseman <ethteck@gmail.com>2020-06-21 17:50:32 -0400
committerGitHub <noreply@github.com>2020-06-21 17:50:32 -0400
commitafce6a3c3685e09d94aa094ab4f2bb346d58b0ed (patch)
tree18ffba5f00ceb4789bbabecde130e16985dab58f /progress.py
parent5f61c105b49cf9ee653b8eec2a29514412d6e9ff (diff)
Output progress to csv file (#218)
Diffstat (limited to 'progress.py')
-rwxr-xr-xprogress.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/progress.py b/progress.py
index c9b278be6..23d4f0ae6 100755
--- a/progress.py
+++ b/progress.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import argparse
-import json
+import csv
import os
import re
import time
@@ -9,8 +9,8 @@ import time
parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.")
parser.add_argument("-m", "--matching", dest='matching', action='store_true',
help="Output matching progress instead of decompilation progress")
-parser.add_argument("-j", "--json", dest="json", action="store_true",
- help="Output results as a json file at build/progress.json")
+parser.add_argument("-c", "--csv", dest="csv", action="store_true",
+ help="Output results in CSV format")
args = parser.parse_args()
NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif"
@@ -114,17 +114,9 @@ ovlPct = 100 * ovl / ovlSize
compiled_bytes = total
bytesPerHeartPiece = compiled_bytes / 80
-if args.json:
+if args.csv:
timestamp = str(time.time())
- json_dict = {"reports":{}}
- json_dict["reports"][timestamp] = {
- "total_percent": srcPct,
- "boot_percent": bootPct,
- "code_percent": codePct,
- "overlay_percent": ovlPct
- }
- with open("build/progress.json", "w", newline="\n") as f:
- json.dump(json_dict, f)
+ print(timestamp + "," + str(srcPct) + "," + str(asmPct) + "," + str(bootPct) + "," + str(codePct) + "," + str(ovlPct))
else:
adjective = "decompiled" if not args.matching else "matched"