From de0d3d172675cdc0edaa164169eb9ca2a36a2e7d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 15 Apr 2020 13:36:21 -0700 Subject: [PATCH] freedreno/log-parser: support to read gzip'd logs ~50MB gzip'd log files are nicer than ~300MB uncompressed Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/log-parser.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/log-parser.py b/src/gallium/drivers/freedreno/log-parser.py index a69a55b5ef2..c97b829d467 100755 --- a/src/gallium/drivers/freedreno/log-parser.py +++ b/src/gallium/drivers/freedreno/log-parser.py @@ -2,6 +2,8 @@ import re import sys +import gzip +import io class GMEMPass: @@ -59,7 +61,12 @@ def dump_gmem_passes(gmem_passes, blit_time, sysmem_time, total_time): )) def main(): - file = open(sys.argv[1], "r") + filename = sys.argv[1] + if filename.endswith(".gz"): + file = gzip.open(filename, "r") + file = io.TextIOWrapper(file) + else: + file = open(filename, "r") lines = file.read().split('\n') compute_match = re.compile(r"COMPUTE: START") -- 2.30.2