Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315903 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2016-01-24 15:00 +0100 |
| Last post | 2016-01-24 15:00 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio Namhyung Kim <namhyung@kernel.org> - 2016-01-24 15:00 +0100
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-01-24 15:00 +0100 |
| Subject | [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio |
| Message-ID | <qUtmX-5A8-25@gated-at.bofh.it> |
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@kernel.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
Back to top | Article view | linux.kernel
csiph-web