summaryrefslogtreecommitdiffstats
path: root/src/gallium/tools
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2013-01-30 15:45:08 -0700
committerBrian Paul <brianp@vmware.com>2013-02-01 08:00:28 -0700
commit9a91ce94484789424361f22387ba15688d6bcc7d (patch)
tree45a00aef1277dd021ff729c896831be08af0054d /src/gallium/tools
parentb516bf46ef7869a3cbf3fff85c77a25d4c882133 (diff)
downloadexternal_mesa3d-9a91ce94484789424361f22387ba15688d6bcc7d.zip
external_mesa3d-9a91ce94484789424361f22387ba15688d6bcc7d.tar.gz
external_mesa3d-9a91ce94484789424361f22387ba15688d6bcc7d.tar.bz2
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')
-rwxr-xr-xsrc/gallium/tools/trace/model.py7
-rwxr-xr-xsrc/gallium/tools/trace/parse.py11
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: