1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Output progress to csv file (#218)

This commit is contained in:
Ethan Roseman 2020-06-21 17:50:32 -04:00 committed by GitHub
parent 5f61c105b4
commit afce6a3c36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 15 deletions

3
Jenkinsfile vendored
View file

@ -20,8 +20,7 @@ pipeline {
branch 'master' branch 'master'
} }
steps { steps {
sh 'python3 progress.py -j' sh 'python3 progress.py -c >> /var/www/html/reports/progress.csv'
sh 'mv build/progress.json /var/www/html/reports/progress.json'
} }
} }
} }

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import json import csv
import os import os
import re import re
import time import time
@ -9,8 +9,8 @@ import time
parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.") parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.")
parser.add_argument("-m", "--matching", dest='matching', action='store_true', parser.add_argument("-m", "--matching", dest='matching', action='store_true',
help="Output matching progress instead of decompilation progress") help="Output matching progress instead of decompilation progress")
parser.add_argument("-j", "--json", dest="json", action="store_true", parser.add_argument("-c", "--csv", dest="csv", action="store_true",
help="Output results as a json file at build/progress.json") help="Output results in CSV format")
args = parser.parse_args() args = parser.parse_args()
NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif" 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 compiled_bytes = total
bytesPerHeartPiece = compiled_bytes / 80 bytesPerHeartPiece = compiled_bytes / 80
if args.json: if args.csv:
timestamp = str(time.time()) timestamp = str(time.time())
json_dict = {"reports":{}} print(timestamp + "," + str(srcPct) + "," + str(asmPct) + "," + str(bootPct) + "," + str(codePct) + "," + str(ovlPct))
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)
else: else:
adjective = "decompiled" if not args.matching else "matched" adjective = "decompiled" if not args.matching else "matched"