From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780AbcAXN5D (ORCPT ); Sun, 24 Jan 2016 08:57:03 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35387 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753576AbcAXNyz (ORCPT ); Sun, 24 Jan 2016 08:54:55 -0500 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , Andi Kleen , David Ahern , Frederic Weisbecker , Wang Nan Subject: [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio Date: Sun, 24 Jan 2016 22:53:28 +0900 Message-Id: <1453643615-1616-6-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1453643615-1616-1-git-send-email-namhyung@kernel.org> References: <1453643615-1616-1-git-send-email-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The output of callchains on stdio shows pipes to display callchain depth and continuation. But if --percent-limit option is given, it should take it into account so that it can omit unnecessary pipes on the last callchain node. For example, when 0.03 percent limit is given: Before) $ perf report --stdio --percent-limit 0.03 ... 0.06% sleep [kernel.vmlinux] [k] kmem_cache_alloc_trace | ---kmem_cache_alloc_trace perf_event_mmap | |--0.04%--mmap_region | do_mmap_pgoff | vm_mmap_pgoff ^^^ here It's because there's a node which has 0.02% of overhead but it's now shown due to the percent limit. After applying this patch, After) $ perf report --stdio --percent-limit 0.03 ... 0.06% sleep [kernel.vmlinux] [k] kmem_cache_alloc_trace | ---kmem_cache_alloc_trace perf_event_mmap | --0.04%--mmap_region do_mmap_pgoff vm_mmap_pgoff Signed-off-by: Namhyung Kim --- tools/perf/ui/stdio/hist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 7bf05e82766f..eae25efa684e 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -120,6 +120,21 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, new_depth_mask &= ~(1 << (depth - 1)); /* + * If the next node is under percent limit, remaining + * callchains won't be shown. So no need to keep the pipes. + */ + if (next) { + struct callchain_node *next_child; + + next_child = rb_entry(next, struct callchain_node, rb_node); + cumul = callchain_cumul_counts(next_child); + percent = 100.0 * cumul / total_samples; + + if (percent < callchain_param.min_percent) + new_depth_mask &= ~(1 << (depth - 1)); + } + + /* * But we keep the older depth mask for the line separator * to keep the level link until we reach the last child */ -- 2.6.4