All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] perf top: Support --group-sort-idx to change the sort order
@ 2020-03-24 22:07 Jin Yao
  2020-03-24 22:07 ` [PATCH v2 2/2] perf top: support hotkey to change " Jin Yao
  2020-04-04  8:41 ` [tip: perf/urgent] perf top: Support --group-sort-idx to change the " tip-bot2 for Jin Yao
  0 siblings, 2 replies; 6+ messages in thread
From: Jin Yao @ 2020-03-24 22:07 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

perf report has supported the option --group-sort-idx, which
sorts the output by the event at the index n in event group.

For example,
perf record -e cycles,instructions,cache-misses
perf report --group --group-sort-idx 2 --stdio

The perf-report output is sorted by cache-misses.

This patch supports --group-sort-idx in perf-top.

For example,
perf top --group -e cycles,instructions,cache-misses --group-sort-idx 2

The perf-top output is sorted by cache-misses.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/Documentation/perf-top.txt | 5 +++++
 tools/perf/builtin-top.c              | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 324b6b53c86b..0e97dcef794d 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>::
 --freq=<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 d2539b793f9d..494c7b9a1022 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1545,6 +1545,10 @@ int cmd_top(int argc, const char **argv)
 			"number of thread to run event synthesize"),
 	OPT_BOOLEAN(0, "namespaces", &opts->record_namespaces,
 		    "Record namespaces 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()
 	};
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-04  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-24 22:07 [PATCH v2 1/2] perf top: Support --group-sort-idx to change the sort order Jin Yao
2020-03-24 22:07 ` [PATCH v2 2/2] perf top: support hotkey to change " Jin Yao
2020-03-30  0:43   ` Jin, Yao
2020-03-30 15:26     ` Arnaldo Carvalho de Melo
2020-04-04  8:41   ` [tip: perf/urgent] perf top: Support " tip-bot2 for Jin Yao
2020-04-04  8:41 ` [tip: perf/urgent] perf top: Support --group-sort-idx to change the " tip-bot2 for Jin Yao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.