lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453643615-1616-6-git-send-email-namhyung@kernel.org>
Date:	Sun, 24 Jan 2016 22:53:28 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio

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 <namhyung@...nel.org>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ