From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754835AbcITVhv (ORCPT ); Tue, 20 Sep 2016 17:37:51 -0400 Received: from terminus.zytor.com ([198.137.202.10]:38830 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752931AbcITVhs (ORCPT ); Tue, 20 Sep 2016 17:37:48 -0400 Date: Tue, 20 Sep 2016 14:37:15 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: jolsa@kernel.org, namhyung@kernel.org, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, andi@firstfloor.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, milian.wolff@kdab.com Reply-To: jolsa@kernel.org, namhyung@kernel.org, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com, mingo@kernel.org, andi@firstfloor.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, milian.wolff@kdab.com In-Reply-To: <20160912061958.16656-2-namhyung@kernel.org> References: <20160912061958.16656-2-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists browser: Fix event group display Git-Commit-ID: d9ea48bc4e7cc297ca1073fa3f90ed80d964b7b4 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: d9ea48bc4e7cc297ca1073fa3f90ed80d964b7b4 Gitweb: http://git.kernel.org/tip/d9ea48bc4e7cc297ca1073fa3f90ed80d964b7b4 Author: Namhyung Kim AuthorDate: Mon, 12 Sep 2016 15:19:52 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 12 Sep 2016 11:10:26 -0300 perf hists browser: Fix event group display Milian reported that the event group on TUI shows duplicated overhead. This was due to a bug on calculating hpp->buf position. The hpp_advance() was called from __hpp__slsmg_color_printf() on TUI but it's already called from the hpp__call_print_fn macro in __hpp__fmt(). The end result is that the print function returns number of bytes it printed but the buffer advanced twice of the length. This is generally not a problem since it doesn't need to access the buffer again. But with event group, overhead needs to be printed multiple times and hist_entry__snprintf_alignment() tries to fill the space with buffer after it printed. So it (brokenly) showed the last overhead again. The bug was there from the beginning, but I think it's only revealed when the alignment function was added. Reported-by: Milian Wolff Signed-off-by: Namhyung Kim Cc: Andi Kleen Cc: Jiri Olsa Cc: Peter Zijlstra Fixes: 89fee7094323 ("perf hists: Do column alignment on the format iterator") Link: http://lkml.kernel.org/r/20160912061958.16656-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/hists.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index f0611c9..35e44b1 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1097,7 +1097,6 @@ static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt, ...) ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); ui_browser__printf(arg->b, "%s", hpp->buf); - advance_hpp(hpp, ret); return ret; }