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>
This commit is contained in:
Matti Hamalainen
2021-04-20 15:24:42 +03:00
committed by Marge Bot
parent 0834a42773
commit 054b2afcb9
3 changed files with 12 additions and 8 deletions
+7 -4
View File
@@ -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)
+4 -1
View File
@@ -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):
+1 -3
View File
@@ -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' \