lkml.org 
[lkml]   [2016]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 08/12] perf hists browser: Apply callchain percent limit
Date
Currently 'perf report --tui' misses to check percent limit on
callchains. Fix it.

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
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
\
 
 \ /
  Last update: 2016-01-24 15:21    [W:0.091 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site