summaryrefslogtreecommitdiff
path: root/src/gallium/tools/trace
diff options
context:
space:
mode:
authorMatti Hamalainen <ccr@tnsp.org>2021-04-20 15:24:42 +0300
committerMarge Bot <eric+marge@anholt.net>2021-05-07 15:48:03 +0000
commit054b2afcb9344cab346c8d53ae8909f1acd07319 (patch)
treef09579fe9ae637d579d5ffc0af610c486741ad57 /src/gallium/tools/trace
parent0834a42773fa234f00b87151473a7b086c31e066 (diff)
gallium/tools: implement better suppression of variants
Previously some variants (such as execution time and call number were suppressed in tracediff.sh via a sed script. It makes sense to implement an option to leave out such variants to begin with in dump.py, so let's do so and use it. Signed-off-by: Matti Hamalainen <ccr@tnsp.org> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10648>
Diffstat (limited to 'src/gallium/tools/trace')
-rwxr-xr-xsrc/gallium/tools/trace/model.py11
-rwxr-xr-xsrc/gallium/tools/trace/parse.py5
-rwxr-xr-xsrc/gallium/tools/trace/tracediff.sh4
3 files changed, 12 insertions, 8 deletions
diff --git a/src/gallium/tools/trace/model.py b/src/gallium/tools/trace/model.py
index 1cd3c18d987..fad3241a7d7 100755
--- a/src/gallium/tools/trace/model.py
+++ b/src/gallium/tools/trace/model.py
@@ -45,7 +45,7 @@ class Node:
def __str__(self):
stream = StringIO()
formatter = format.Formatter(stream)
- pretty_printer = PrettyPrinter(formatter)
+ pretty_printer = PrettyPrinter(formatter, {})
self.visit(pretty_printer)
return stream.getvalue()
@@ -164,9 +164,11 @@ class Visitor:
class PrettyPrinter:
- def __init__(self, formatter):
+ def __init__(self, formatter, options):
self.formatter = formatter
+ self.options = options
+
def visit_literal(self, node):
if node.value is None:
self.formatter.literal('NULL')
@@ -208,7 +210,8 @@ class PrettyPrinter:
self.formatter.address(node.address)
def visit_call(self, node):
- self.formatter.text('%s ' % node.no)
+ if not self.options.suppress_variants:
+ self.formatter.text('%s ' % node.no)
if node.klass is not None:
self.formatter.function(node.klass + '::' + node.method)
else:
@@ -225,7 +228,7 @@ class PrettyPrinter:
if node.ret is not None:
self.formatter.text(' = ')
node.ret.visit(self)
- if node.time is not None:
+ if not self.options.suppress_variants and node.time is not None:
self.formatter.text(' // time ')
node.time.visit(self)
diff --git a/src/gallium/tools/trace/parse.py b/src/gallium/tools/trace/parse.py
index d25b0b258c6..31e6b51668e 100755
--- a/src/gallium/tools/trace/parse.py
+++ b/src/gallium/tools/trace/parse.py
@@ -359,7 +359,7 @@ class TraceDumper(TraceParser):
self.formatter = format.Formatter(outStream)
else:
self.formatter = format.DefaultFormatter(outStream)
- self.pretty_printer = PrettyPrinter(self.formatter)
+ self.pretty_printer = PrettyPrinter(self.formatter, options)
def handle_call(self, call):
call.visit(self.pretty_printer)
@@ -400,6 +400,9 @@ class Main:
optparser.add_argument("-p", "--plain",
action="store_const", const=True, default=False,
dest="plain", help="disable ANSI color etc. formatting")
+ optparser.add_argument("-S", "--suppress",
+ action="store_const", const=True, default=False,
+ dest="suppress_variants", help="suppress some variants in output for better diffability")
return optparser
def process_arg(self, stream, options):
diff --git a/src/gallium/tools/trace/tracediff.sh b/src/gallium/tools/trace/tracediff.sh
index be3dba331dd..95ab50d7584 100755
--- a/src/gallium/tools/trace/tracediff.sh
+++ b/src/gallium/tools/trace/tracediff.sh
@@ -49,13 +49,11 @@ strip_dump()
OUTFILE="$1"
shift
- python3 "$TRACEDUMP" --plain "$@" "$INFILE" \
+ python3 "$TRACEDUMP" --plain --suppress "$@" "$INFILE" \
| sed \
- -e 's@ // time .*@@' \
-e '/pipe_screen::is_format_supported/d' \
-e '/pipe_screen::get_\(shader_\)\?paramf\?/d' \
-e 's/\r$//g' \
- -e 's/^[0-9]\+ //' \
-e 's/pipe = \w\+/pipe/g' \
-e 's/screen = \w\+/screen/g' \
-e 's/, /,\n\t/g' \