tools/trace: Don't crash if a trace has no timing information.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Jul 2013 11:05:57 +0000 (12:05 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Jul 2013 11:05:57 +0000 (12:05 +0100)
src/gallium/tools/trace/model.py
src/gallium/tools/trace/parse.py

index 82aca6935bfd0bba9bc089bca012fc064c68339c..03bd74120b3efdd4f9eff997b465dd3421b0bbf1 100755 (executable)
@@ -230,8 +230,9 @@ class PrettyPrinter:
         if node.ret is not None:
             self.formatter.text(' = ')
             node.ret.visit(self)
-        self.formatter.text(' // time ')
-        node.time.visit(self)
+        if node.time is not None:
+            self.formatter.text(' // time ')
+            node.time.visit(self)
 
     def visit_trace(self, node):
         for call in node.calls:
index 6a0d2fedb9da56c41a61a0c117f1e78a2bd602e0..09a19d8b034721c831b6fcfac2980f4d96b79640 100755 (executable)
@@ -214,7 +214,7 @@ class TraceParser(XmlParser):
         method = attrs['method']
         args = []
         ret = None
-        time = 0
+        time = None
         while self.token.type == ELEMENT_START:
             if self.token.name_or_data == 'arg':
                 arg = self.parse_arg()