freedreno/log-parser: support to read gzip'd logs
authorRob Clark <robdclark@chromium.org>
Wed, 15 Apr 2020 20:36:21 +0000 (13:36 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 23:31:58 +0000 (23:31 +0000)
~50MB gzip'd log files are nicer than ~300MB uncompressed

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4750>

src/gallium/drivers/freedreno/log-parser.py

index a69a55b5ef2062e394321490f07cc022df319c24..c97b829d467a92ed344f732db6d5fc0bbfcf5d85 100755 (executable)
@@ -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")