scripts: Adopted default visibility in scripts with complex fields

This makes it so scripts with complex fields will still output all
fields to output csv/json files, while only showing a user-friendly
subset unless -f/--field is explicitly provided.

While internal fields are often too much information to show by default,
csv/json files are expected to go to other scripts, not humans. So more
information is more useful up until you actually hit a performance
bottleneck.

And if you _do_ somehow manage to hit a performance bottleneck, you can
always limit the output with explicit -f/--field flags.
This commit is contained in:
Christopher Haster
2025-03-01 02:44:35 -06:00
parent 051bf66f9a
commit e71aca65d9
5 changed files with 19 additions and 12 deletions
+6 -4
View File
@@ -1484,13 +1484,15 @@ def report(perf_paths, *,
else:
by = ['function']
visible = None
if fields is None:
fields = ['cycles', 'bmisses', 'branches', 'cmisses', 'caches']
if not branches and not caches:
fields = ['cycles']
visible = ['cycles']
elif branches:
fields = ['bmisses', 'branches']
visible = ['bmisses', 'branches']
else:
fields = ['cmisses', 'caches']
visible = ['cmisses', 'caches']
# figure out depth
if depth is None:
@@ -1579,7 +1581,7 @@ def report(perf_paths, *,
# print table
table(PerfResult, results, diff_results,
by=by,
fields=fields,
fields=visible if visible is not None else fields,
sort=sort,
labels=labels,
depth=depth,