[PATCH 12/12] perf report: Fix callchain percent limit on --gtk
From: Namhyung Kim
Date: Sun Jan 24 2016 - 08:55:31 EST
When a percent limit is given, it should take callchains into account.
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/ui/gtk/hists.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 0f8dcfdfb10f..8652c3c967b9 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -100,9 +100,14 @@ static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *sto
struct callchain_list *chain;
GtkTreeIter iter, new_parent;
bool need_new_parent;
+ double percent;
node = rb_entry(nd, struct callchain_node, rb_node);
+ percent = 100.0 * callchain_cumul_hits(node) / total;
+ if (percent < callchain_param.min_percent)
+ continue;
+
new_parent = *parent;
need_new_parent = !has_single_node;
@@ -164,9 +169,14 @@ static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *s
char buf[64];
char *str, *str_alloc = NULL;
bool first = true;
+ double percent;
node = rb_entry(nd, struct callchain_node, rb_node);
+ percent = 100.0 * callchain_cumul_hits(node) / total;
+ if (percent < callchain_param.min_percent)
+ continue;
+
callchain_node__make_parent_list(node);
list_for_each_entry(chain, &node->parent_val, list) {
@@ -224,9 +234,14 @@ static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *st
GtkTreeIter iter, new_parent;
bool need_new_parent;
u64 child_total;
+ double percent;
node = rb_entry(nd, struct callchain_node, rb_node);
+ percent = 100.0 * callchain_cumul_hits(node) / total;
+ if (percent < callchain_param.min_percent)
+ continue;
+
new_parent = *parent;
need_new_parent = !has_single_node && (node->val_nr > 1);
--
2.6.4