diff options
author | José Fonseca <[email protected]> | 2008-08-21 18:45:43 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-08-21 18:46:04 +0100 |
commit | 10624065b0dc631164d786b2c39f35655e55eadf (patch) | |
tree | 3aeb30e8f7baed89a53cb8a845fe7a2bc51b24e3 /src/gallium/state_trackers/python | |
parent | 34d12c1787116c254e528dd981810b7b78b7a2ee (diff) |
python/retrace: Support gziped traces.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/interpreter.py | 7 | ||||
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/parser.py | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 7502c096b66..f596a54d102 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -471,7 +471,12 @@ class Interpreter: def main(): for arg in sys.argv[1:]: - parser = TraceParser(open(arg, 'rt')) + if arg.endswith('.gz'): + import gzip + stream = gzip.GzipFile(arg, 'rt') + else: + stream = open(arg, 'rt') + parser = TraceParser(stream) trace = parser.parse() interpreter = Interpreter() interpreter.interpret(trace) diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py index d02fd7f741f..2ee4d3068db 100755 --- a/src/gallium/state_trackers/python/retrace/parser.py +++ b/src/gallium/state_trackers/python/retrace/parser.py @@ -322,9 +322,15 @@ class TraceParser(XmlParser): def main(): for arg in sys.argv[1:]: - parser = TraceParser(open(arg, 'rt')) + if arg.endswith('.gz'): + import gzip + stream = gzip.GzipFile(arg, 'rt') + else: + stream = open(arg, 'rt') + parser = TraceParser(stream) trace = parser.parse() - print trace + for call in trace.calls: + print call if __name__ == '__main__': |