diff options
Diffstat (limited to 'src/gallium/tools')
-rwxr-xr-x | src/gallium/tools/trace/model.py | 7 | ||||
-rwxr-xr-x | src/gallium/tools/trace/parse.py | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/tools/trace/model.py b/src/gallium/tools/trace/model.py index 9f2d5bc..8276a8f 100755 --- a/src/gallium/tools/trace/model.py +++ b/src/gallium/tools/trace/model.py @@ -101,12 +101,13 @@ class Pointer(Node): class Call: - def __init__(self, no, klass, method, args, ret): + def __init__(self, no, klass, method, args, ret, time): self.no = no self.klass = klass self.method = method self.args = args self.ret = ret + self.time = time def visit(self, visitor): visitor.visit_call(self) @@ -210,7 +211,9 @@ class PrettyPrinter: if node.ret is not None: self.formatter.text(' = ') node.ret.visit(self) - + self.formatter.text(' // time ') + node.time.visit(self) + def visit_trace(self, node): for call in node.calls: call.visit(self) diff --git a/src/gallium/tools/trace/parse.py b/src/gallium/tools/trace/parse.py index feb0b64..07f2d6c 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: |