From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752991AbdCOSgS (ORCPT ); Wed, 15 Mar 2017 14:36:18 -0400 Received: from terminus.zytor.com ([65.50.211.136]:38972 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752101AbdCOSgP (ORCPT ); Wed, 15 Mar 2017 14:36:15 -0400 Date: Wed, 15 Mar 2017 11:35:43 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: linux-kernel@vger.kernel.org, jolsa@kernel.org, mingo@kernel.org, acme@redhat.com, hpa@zytor.com, namhyung@kernel.org, tglx@linutronix.de, peterz@infradead.org Reply-To: jolsa@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, acme@redhat.com, hpa@zytor.com In-Reply-To: <20170307150851.22304-6-namhyung@kernel.org> References: <20170307150851.22304-6-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf c2c: Fix display bug when using pipe Git-Commit-ID: 1936feae54a6724a27a6ca1b948fd0e80371f7b0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1936feae54a6724a27a6ca1b948fd0e80371f7b0 Gitweb: http://git.kernel.org/tip/1936feae54a6724a27a6ca1b948fd0e80371f7b0 Author: Namhyung Kim AuthorDate: Wed, 8 Mar 2017 00:08:33 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 7 Mar 2017 12:48:46 -0300 perf c2c: Fix display bug when using pipe Currently 'perf c2c report' determines display mode using the --stdio option, but it could be a problem if stdout is not a tty since setup_browser falls back to stdio in this case. But perf c2c didn't know this and tried to use TUI browser anyway. It should check "use_browser" variable instead. For example, the following command showed nothing and broke terminal setting. Now it's fixed.. $ perf c2c report | head ================================================= Trace Event Information ================================================= Total records : 136 Locked Load/Store Operations : 6 Load Operations : 62 Loads - uncacheable : 0 Loads - IO : 1 Loads - Miss : 7 Loads - no mapping : 2 Committer notes: When trying it without a proper perf.data file it results in a stuck terminal, just as Namhyung reported above: [acme@jouet ~]$ perf c2c report | head WARNING: no sample cpu value[acme@jouet ~]$ One has to kill it from some other xterm. Confirm that this patch fixes it: After: $ perf c2c report | head WARNING: no sample cpu value================================================= Trace Event Information ================================================= Total records : 14 Locked Load/Store Operations : 0 Load Operations : 0 Loads - uncacheable : 0 Loads - IO : 0 Loads - Miss : 0 Loads - no mapping : 0 $ Signed-off-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Acked-by: Jiri Olsa Cc: Peter Zijlstra Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170307150851.22304-6-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 3fac30e..5cd6d7a 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2334,7 +2334,7 @@ out: static void perf_c2c_display(struct perf_session *session) { - if (c2c.use_stdio) + if (use_browser == 0) perf_c2c__hists_fprintf(stdout, session); else perf_c2c__hists_browse(&c2c.hists.hists);