linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 1/4] perf report: Fix incorrectly added dimensions as switch perf data file
@ 2019-12-20  1:37 Jin Yao
  2019-12-20  1:37 ` [PATCH v6 2/4] perf report: Change sort order by a specified event in group Jin Yao
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Jin Yao @ 2019-12-20  1:37 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

We observed an issue that was some extra columns displayed after switching
perf data file in browser. The steps to reproduce:

1. perf record -a -e cycles,instructions -- sleep 3
2. perf report --group
3. In browser, we use hotkey 's' to switch to another perf.data
4. Now in browser, the extra columns 'Self' and 'Children' are displayed.

The issue is setup_sorting() executed again after repeat path, so dimensions
are added again.

This patch checks the last key returned from __cmd_report(). If it's
K_SWITCH_INPUT_DATA, skips the setup_sorting().

 v6:
 ---
 No change.

 v5:
 ---
 New patch in v5.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/builtin-report.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 387311c67264..de988589d99b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1076,6 +1076,7 @@ int cmd_report(int argc, const char **argv)
 	struct stat st;
 	bool has_br_stack = false;
 	int branch_mode = -1;
+	int last_key = 0;
 	bool branch_call_mode = false;
 #define CALLCHAIN_DEFAULT_OPT  "graph,0.5,caller,function,percent"
 	static const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
@@ -1450,7 +1451,8 @@ int cmd_report(int argc, const char **argv)
 		sort_order = sort_tmp;
 	}
 
-	if (setup_sorting(session->evlist) < 0) {
+	if ((last_key != K_SWITCH_INPUT_DATA) &&
+	    (setup_sorting(session->evlist) < 0)) {
 		if (sort_order)
 			parse_options_usage(report_usage, options, "s", 1);
 		if (field_order)
@@ -1530,6 +1532,7 @@ int cmd_report(int argc, const char **argv)
 	ret = __cmd_report(&report);
 	if (ret == K_SWITCH_INPUT_DATA) {
 		perf_session__delete(session);
+		last_key = K_SWITCH_INPUT_DATA;
 		goto repeat;
 	} else
 		ret = 0;
-- 
2.17.1


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

end of thread, other threads:[~2020-01-20 15:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20  1:37 [PATCH v6 1/4] perf report: Fix incorrectly added dimensions as switch perf data file Jin Yao
2019-12-20  1:37 ` [PATCH v6 2/4] perf report: Change sort order by a specified event in group Jin Yao
2020-01-20 15:11   ` Jin, Yao
2019-12-20  1:37 ` [PATCH v6 3/4] perf report: Support a new key to reload the browser Jin Yao
2019-12-20  1:37 ` [PATCH v6 4/4] perf report: support hotkey to let user select any event for sorting Jin Yao
2019-12-20 13:53 ` [PATCH v6 1/4] perf report: Fix incorrectly added dimensions as switch perf data file Jiri Olsa
2019-12-20 16:34 ` Arnaldo Carvalho de Melo
2019-12-23  0:55   ` Jin, Yao
2019-12-23 13:02     ` Arnaldo Carvalho de Melo
2019-12-23 21:35 ` [tip: perf/urgent] " tip-bot2 for Jin Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).