diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index ddab103af8c7..487737a725e9 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt @@ -53,6 +53,11 @@ Default is to monitor all CPUS. --group:: Put the counters into a counter group. +--group-sort-idx:: + Sort the output by the event at the index n in group. If n is invalid, + sort by the first event. It can support multiple groups with different + amount of events. WARNING: This should be used on grouped events. + -F :: --freq=:: Profile at this frequency. Use 'max' to use the currently maximum diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 02ea2cf2a3d9..9ff7943d2014 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1560,6 +1560,10 @@ int cmd_top(int argc, const char **argv) "Record namespaces events"), OPT_BOOLEAN(0, "all-cgroups", &opts->record_cgroup, "Record cgroup events"), + OPT_INTEGER(0, "group-sort-idx", &symbol_conf.group_sort_idx, + "Sort the output by the event at the index n in group. " + "If n is invalid, sort by the first event. " + "WARNING: should be used on grouped events."), OPTS_EVSWITCH(&top.evswitch), OPT_END() };