gallium/tools: implement "high-level" overview mode option in dump scripts

As per the suggestion in #4609, implement mode/option -M/--method-only
which only prints call method names, for quick overview of what is
happening in the trace. The same option can be used with both
dump.py and tracediff.sh.

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-21 17:12:26 +03:00
committed by Marge Bot
parent 0112e3c7ea
commit 7ef828b563
3 changed files with 21 additions and 13 deletions
+16 -12
View File
@@ -228,22 +228,26 @@ class PrettyPrinter:
def visit_call(self, node):
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:
self.formatter.function(node.method)
self.formatter.text('(')
sep = ''
for name, value in node.args:
self.formatter.text(sep)
self.formatter.variable(name)
self.formatter.text(' = ')
value.visit(self)
sep = ', '
self.formatter.text(')')
if node.ret is not None:
self.formatter.text(' = ')
node.ret.visit(self)
if not self.options.method_only:
self.formatter.text('(')
sep = ''
for name, value in node.args:
self.formatter.text(sep)
self.formatter.variable(name)
self.formatter.text(' = ')
value.visit(self)
sep = ', '
self.formatter.text(')')
if node.ret is not None:
self.formatter.text(' = ')
node.ret.visit(self)
if not self.options.suppress_variants and node.time is not None:
self.formatter.text(' // time ')
node.time.visit(self)
+3
View File
@@ -424,6 +424,9 @@ class Main:
optparser.add_argument("-N", "--named",
action="store_const", const=True, default=False,
dest="named_ptrs", help="generate symbolic names for raw pointer values")
optparser.add_argument("-M", "--method-only",
action="store_const", const=True, default=False,
dest="method_only", help="output only call names without arguments")
return optparser
+2 -1
View File
@@ -58,6 +58,7 @@ print_help()
echo ""
echo "dump.py options:"
echo " -N, --named generate symbolic names for raw pointer values"
echo " -M, --method-only output only call names without arguments"
echo ""
echo "sdiff options:"
echo " -d, --minimal try hard to find a smaller set of changes"
@@ -109,7 +110,7 @@ do
print_help
exit 0
;;
-N|--named)
-N|--named|-M|--method-only)
DUMP_ARGS+=("$1")
shift
;;