From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753183AbcKHNJt (ORCPT ); Tue, 8 Nov 2016 08:09:49 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33400 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753065AbcKHNJo (ORCPT ); Tue, 8 Nov 2016 08:09:44 -0500 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , Markus Trippelsdorf Subject: [PATCH 4/4] perf hists: Fix column length on --hierarchy Date: Tue, 8 Nov 2016 22:08:33 +0900 Message-Id: <20161108130833.9263-5-namhyung@kernel.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161108130833.9263-1-namhyung@kernel.org> References: <20161108130833.9263-1-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Markus reported that there's a weird behavior on perf top --hierarch regarding the column length. Looking at the code, I found a debious code which affects the symtoms. When --hierarchy option is used, the last column length might be inaccurate since it skips to update the length on leaf entries. I cannot remember why it did and looks like a leftover from previous version during the development. Anyway updating the column length often is not harmful. So let's move the code out. Reported-by: Markus Trippelsdorf Signed-off-by: Namhyung Kim --- tools/perf/util/hist.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index e1be4132054d..6770a9645609 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1601,18 +1601,18 @@ static void hists__hierarchy_output_resort(struct hists *hists, if (prog) ui_progress__update(prog, 1); + hists->nr_entries++; + if (!he->filtered) { + hists->nr_non_filtered_entries++; + hists__calc_col_len(hists, he); + } + if (!he->leaf) { hists__hierarchy_output_resort(hists, prog, &he->hroot_in, &he->hroot_out, min_callchain_hits, use_callchain); - hists->nr_entries++; - if (!he->filtered) { - hists->nr_non_filtered_entries++; - hists__calc_col_len(hists, he); - } - continue; } -- 2.10.1