From 9a91ce94484789424361f22387ba15688d6bcc7d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Jan 2013 15:45:08 -0700 Subject: trace: measure time for each gallium call To get a rough idea of how much time is spent in each gallium driver function. The time is measured in microseconds. --- src/gallium/tools/trace/parse.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gallium/tools/trace/parse.py') diff --git a/src/gallium/tools/trace/parse.py b/src/gallium/tools/trace/parse.py index feb0b64e231..07f2d6c7659 100755 --- a/src/gallium/tools/trace/parse.py +++ b/src/gallium/tools/trace/parse.py @@ -215,6 +215,7 @@ class TraceParser(XmlParser): method = attrs['method'] args = [] ret = None + time = 0 while self.token.type == ELEMENT_START: if self.token.name_or_data == 'arg': arg = self.parse_arg() @@ -224,11 +225,13 @@ class TraceParser(XmlParser): elif self.token.name_or_data == 'call': # ignore nested function calls self.parse_call() + elif self.token.name_or_data == 'time': + time = self.parse_time() else: raise TokenMismatch(" or ", self.token) self.element_end('call') - return Call(no, klass, method, args, ret) + return Call(no, klass, method, args, ret, time) def parse_arg(self): attrs = self.element_start('arg') @@ -245,6 +248,12 @@ class TraceParser(XmlParser): return value + def parse_time(self): + attrs = self.element_start('time') + time = self.parse_value(); + self.element_end('time') + return time + def parse_value(self): expected_tokens = ('null', 'bool', 'int', 'uint', 'float', 'string', 'enum', 'array', 'struct', 'ptr', 'bytes') if self.token.type == ELEMENT_START: -- cgit v1.2.3