[PATCH v2 5/6] perf report: Make --skip-empty as default
From: Namhyung Kim
Date: Mon Apr 26 2021 - 21:42:14 EST
so that the compact output is shown by default. Also add
'report.skip-empty' config option to override the default.
Users can also use --no-skip-empty command line option to
change the behavior anytime.
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/Documentation/perf-config.txt | 5 +++++
tools/perf/builtin-report.c | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 154a1ced72b2..b0872c801866 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -123,6 +123,7 @@ Example
queue-size = 0
children = true
group = true
+ skip-empty = true
[llvm]
dump-obj = true
@@ -531,6 +532,10 @@ Variables
0.07% 0.00% noploop ld-2.15.so [.] strcmp
0.03% 0.00% noploop [kernel.kallsyms] [k] timerqueue_del
+ report.skip-empty::
+ This option can change default stat behavior with empty results.
+ If it's set true, 'perf report --stat' will not show 0 stats.
+
top.*::
top.children::
Same as 'report.children'. So if it is enabled, the output of 'top'
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4910194acaa6..36f9ccfeb38a 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -136,6 +136,11 @@ static int report__config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "report.skip-empty")) {
+ rep->skip_empty = perf_config_bool(var, value);
+ return 0;
+ }
+
return 0;
}
@@ -1160,6 +1165,7 @@ int cmd_report(int argc, const char **argv)
.pretty_printing_style = "normal",
.socket_filter = -1,
.annotation_opts = annotation__default_options,
+ .skip_empty = true,
};
const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
--
2.31.1.527.g47e6f16901-goog