diff options
author | Brian Paul <[email protected]> | 2013-01-30 15:45:08 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2013-02-01 08:00:28 -0700 |
commit | 9a91ce94484789424361f22387ba15688d6bcc7d (patch) | |
tree | 45a00aef1277dd021ff729c896831be08af0054d /src/gallium/tools/trace/parse.py | |
parent | b516bf46ef7869a3cbf3fff85c77a25d4c882133 (diff) |
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.
Diffstat (limited to 'src/gallium/tools/trace/parse.py')
-rwxr-xr-x | src/gallium/tools/trace/parse.py | 11 |
1 files changed, 10 insertions, 1 deletions
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("<arg ...> or <ret ...>", 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: |