diff options
Diffstat (limited to 'scripts/parse_log.py')
-rwxr-xr-x | scripts/parse_log.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/parse_log.py b/scripts/parse_log.py index bbca0ea..3a0aed0 100755 --- a/scripts/parse_log.py +++ b/scripts/parse_log.py @@ -12,10 +12,11 @@ score_preset = "SCORE=" score_offset = len(score_preset) def main(args): + results = {} for log_path in args: + stats = defaultdict(lambda: {'hits':[], 'miss': 0}) + level = -1 with open(log_path) as log: - level = -1 - stats = defaultdict(lambda: {'hits':[], 'miss': 0}) for line in log: line.rstrip('\n') if line[0] == "+": @@ -37,10 +38,15 @@ def main(args): stats[level]['hits'].extend(score) continue raise ValueError(f"invalid syntax: {line[1:]}") + if len(stats) > 0: + path = log_path.replace(".log", "").split("-") + e, w = int(path[1][1:]), int(path[2][1:]) + results[(e,w)] = dict(stats) + return results parser = argparse.ArgumentParser(description='process our data log files on end repair') parser.add_argument('files', type=str, nargs='+') if __name__ == "__main__": args = parser.parse_args() - main(args.files) + results = main(args.files) |