# 사용법: python3 summarize_analyze.py baseline [after] import json import sys decoder = json.JSONDecoder() for prefix in sys.argv[1:]: text = open(f"{prefix}_analyze.txt", encoding="utf-8").read() names = [line.split("=== ")[1].split(" ===")[0] for line in text.splitlines() if line.startswith("=== ")] docs, pos = [], 0 while True: start = text.find("{", pos) if start < 0: break doc, pos = decoder.raw_decode(text, start) docs.append(doc) for name, doc in zip(names, docs): block = doc["query_block"] print(f"{prefix:8} {name:16} server_time_ms={block.get('r_total_time_ms')}")