Skip to contentSkip to conversation

perf report: Show all sort keys in help output

tip:perf/urgent tip-bot for Andi Kleen 1 participant 1 message Mar 22, 2019 perf events

lore
Share & tools
lore

tip-bot for Andi Kleen

author merge bot
#0 lore raw
Commit-ID:  702fb9b415e7c99bd671fc0d1da26574c125471a
Gitweb:     https://git.kernel.org/tip/702fb9b415e7c99bd671fc0d1da26574c125471a
Author:     Andi Kleen <[email protected]>
AuthorDate: Thu, 14 Mar 2019 15:49:57 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 19 Mar 2019 16:15:42 -0300

perf report: Show all sort keys in help output

Show all the supported sort keys in the command line help output, so that it's not needed to refer to the manpage.

Before:

% perf report -h
...
-s, --sort <key[,key2...]>
sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ... Please refer the man page for the complete list.

After:

% perf report -h
...
-s, --sort <key[,key2...]>
sort by key(s): overhead overhead_sys overhead_us overhead_guest_sys overhead_guest_us overhead_children sample period pid comm dso symbol parent cpu ...

LPU-Reference: [email protected]

---
 tools/perf/builtin-report.c |  5 ++---
 tools/perf/util/sort.c      | 52 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/sort.h      |  2 ++
 3 files changed, 56 insertions(+), 3 deletions(-)
tools/perf/builtin-report.c +2 -3
index 1921aaa9cece..4054eb1f98ac 100644
@@ -1083,10 +1083,9 @@ int cmd_report(int argc, const char **argv)
 	OPT_BOOLEAN(0, "header-only", &report.header_only,
 		    "Show only data header."),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-		   "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
-		   " Please refer the man page for the complete list."),
+		   sort_help("sort by key(s):")),
 	OPT_STRING('F', "fields", &field_order, "key[,keys...]",
-		   "output field(s): overhead, period, sample plus all of sort keys"),
+		   sort_help("output field(s): overhead period sample ")),
 	OPT_BOOLEAN(0, "show-cpu-utilization", &symbol_conf.show_cpu_utilization,
 		    "Show sample percentage for different cpu modes"),
 	OPT_BOOLEAN_FLAG(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
tools/perf/util/sort.c +52 -0

61 lines not on this page · raw message

tools/perf/util/sort.h +2 -0
index bb9442ab7a0c..ce376a73f964 100644
@@ -296,6 +296,8 @@ void reset_output_field(void);
 void sort__setup_elide(FILE *fp);
 void perf_hpp__set_elide(int idx, bool elide);
 
+const char *sort_help(const char *prefix);
+
 int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
 
 bool is_strict_order(const char *order);