[PATCH 08/12] perf hists browser: Apply callchain percent limit
From: Namhyung Kim
Date: Sun Jan 24 2016 - 08:55:17 EST
Currently 'perf report --tui' misses to check percent limit on
callchains. Fix it.
Reported-by: Andi Kleen <andi@xxxxxxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c7ca36dae89f..3d64a6573d0c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -681,6 +681,14 @@ static int hist_browser__show_callchain_flat(struct hist_browser *browser,
char folded_sign = ' ';
int first = true;
int extra_offset = 0;
+ double percent;
+ u64 hits;
+
+ hits = callchain_cumul_hits(child);
+ percent = 100.0 * hits / total;
+
+ if (percent < callchain_param.min_percent)
+ goto next;
list_for_each_entry(chain, &child->parent_val, list) {
bool was_first = first;
@@ -784,12 +792,20 @@ static int hist_browser__show_callchain_folded(struct hist_browser *browser,
int first = true;
char *value_str = NULL, *value_str_alloc = NULL;
char *chain_str = NULL, *chain_str_alloc = NULL;
+ double percent;
+ u64 hits;
if (arg->row_offset != 0) {
arg->row_offset--;
goto next;
}
+ hits = callchain_cumul_hits(child);
+ percent = 100.0 * hits / total;
+
+ if (percent < callchain_param.min_percent)
+ goto next;
+
if (need_percent) {
char buf[64];
@@ -869,6 +885,14 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser,
char folded_sign = ' ';
int first = true;
int extra_offset = 0;
+ double percent;
+ u64 hits;
+
+ hits = callchain_cumul_hits(child);
+ percent = 100.0 * hits / total;
+
+ if (percent < callchain_param.min_percent)
+ goto next;
list_for_each_entry(chain, &child->val, list) {
bool was_first = first;
@@ -905,6 +929,7 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser,
new_level, row, new_total,
print, arg, is_output_full);
}
+next:
if (is_output_full(browser, row))
break;
node = next;
--
2.6.4