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:
+5
-3
@@ -953,11 +953,13 @@ def main(gcda_paths, *,
|
||||
else:
|
||||
by = ['function']
|
||||
|
||||
visible = None
|
||||
if fields is None:
|
||||
fields = ['calls', 'hits', 'funcs', 'lines', 'branches']
|
||||
if not hits:
|
||||
fields = ['lines', 'branches']
|
||||
visible = ['lines', 'branches']
|
||||
else:
|
||||
fields = ['calls', 'hits']
|
||||
visible = ['calls', 'hits']
|
||||
|
||||
# find sizes
|
||||
if not args.get('use', None):
|
||||
@@ -1019,7 +1021,7 @@ def main(gcda_paths, *,
|
||||
# print table
|
||||
table(CovResult, results, diff_results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
fields=visible if visible is not None else fields,
|
||||
sort=sort,
|
||||
**args)
|
||||
|
||||
|
||||
@@ -2346,7 +2346,6 @@ def main(csv_paths, *,
|
||||
# print table
|
||||
if not args.get('quiet'):
|
||||
table(Result, results, diff_results,
|
||||
# note the use of labels + visible here
|
||||
by=by,
|
||||
fields=visible if visible is not None else fields,
|
||||
sort=sort,
|
||||
|
||||
+4
-2
@@ -1268,8 +1268,10 @@ def main(obj_paths, *,
|
||||
else:
|
||||
by = ['function']
|
||||
|
||||
visible = None
|
||||
if fields is None:
|
||||
fields = ['size']
|
||||
fields = ['off', 'size']
|
||||
visible = ['size']
|
||||
|
||||
# figure out depth
|
||||
if depth is None:
|
||||
@@ -1349,7 +1351,7 @@ def main(obj_paths, *,
|
||||
if not args.get('quiet'):
|
||||
table(CtxResult, results, diff_results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
fields=visible if visible is not None else fields,
|
||||
sort=sort,
|
||||
labels=labels,
|
||||
depth=depth,
|
||||
|
||||
+6
-4
@@ -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,
|
||||
|
||||
+4
-2
@@ -1088,8 +1088,10 @@ def main(obj_paths, *,
|
||||
else:
|
||||
by = ['struct']
|
||||
|
||||
visible = None
|
||||
if fields is None:
|
||||
fields = ['size', 'align']
|
||||
fields = ['off', 'size', 'align']
|
||||
visible = ['size', 'align']
|
||||
|
||||
# figure out depth
|
||||
if depth is None:
|
||||
@@ -1169,7 +1171,7 @@ def main(obj_paths, *,
|
||||
if not args.get('quiet'):
|
||||
table(StructResult, results, diff_results,
|
||||
by=by,
|
||||
fields=fields,
|
||||
fields=visible if visible is not None else fields,
|
||||
sort=sort,
|
||||
labels=labels,
|
||||
depth=depth,
|
||||
|
||||
Reference in New Issue
Block a user