[PATCH] perf report: Check percent limit of single callchain on stdio

From: Namhyung Kim
Date: Tue Jan 26 2016 - 07:40:39 EST


While previous commit ("perf report: Apply callchain percent limit
on --stdio") checked percent limit of callchain, it missed to check a
single-path callchains. It resulted in showing callchains under the
limit if an entry has only single path of call graph.

Reported-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/ui/stdio/hist.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index eae25efa684e..35964579627b 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -199,6 +199,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
int i = 0;
int ret = 0;
char bf[1024];
+ double percent;

/*
* If have one single callchain root, don't bother printing
@@ -208,6 +209,11 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
node = rb_first(root);
if (node && !rb_next(node)) {
cnode = rb_entry(node, struct callchain_node, rb_node);
+
+ percent = 100.0 * callchain_cumul_hits(cnode) / total_samples;
+ if (percent < callchain_param.min_percent)
+ return 0;
+
list_for_each_entry(chain, &cnode->val, list) {
/*
* If we sort by symbol, the first entry is the same than
--
2.6.4