Mesa (master): tools/trace: Don' t crash if a trace has no timing information.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jul 1 11:07:10 UTC 2013


Module: Mesa
Branch: master
Commit: 0fd71ac9eb4fdcc181a4322f7c8244a858b5740d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0fd71ac9eb4fdcc181a4322f7c8244a858b5740d

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Jul  1 12:05:57 2013 +0100

tools/trace: Don't crash if a trace has no timing information.

---

 src/gallium/tools/trace/model.py |    5 +++--
 src/gallium/tools/trace/parse.py |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/tools/trace/model.py b/src/gallium/tools/trace/model.py
index 82aca69..03bd741 100755
--- a/src/gallium/tools/trace/model.py
+++ b/src/gallium/tools/trace/model.py
@@ -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:
diff --git a/src/gallium/tools/trace/parse.py b/src/gallium/tools/trace/parse.py
index 6a0d2fe..09a19d8 100755
--- a/src/gallium/tools/trace/parse.py
+++ b/src/gallium/tools/trace/parse.py
@@ -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()




More information about the mesa-commit mailing list