[PATCH 13/14] perf tools: Apply percent-limit to cumulative percentage

From: Namhyung Kim
Date: Thu Oct 31 2013 - 02:56:58 EST


From: Namhyung Kim <namhyung.kim@xxxxxxx>

If -g cumulative option is given, it needs to show entries which don't
have self overhead. So apply percent-limit to accumulated overhead
percentage in this case.

Cc: Arun Sharma <asharma@xxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 15 ++++++++++++---
tools/perf/ui/gtk/hists.c | 4 ++++
tools/perf/ui/stdio/hist.c | 4 ++++
3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 2cea6cd9824e..07f500d8df1b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -834,6 +834,10 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
if (h->filtered)
continue;

+ if (callchain_param.mode == CHAIN_CUMULATIVE)
+ percent = h->stat_acc->period * 100.0 /
+ hb->hists->stats.total_period;
+
if (percent < hb->min_pcnt)
continue;

@@ -854,10 +858,11 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd,
float percent = h->stat.period * 100.0 /
hists->stats.total_period;

- if (percent < min_pcnt)
- return NULL;
+ if (callchain_param.mode == CHAIN_CUMULATIVE)
+ percent = h->stat_acc->period * 100.0 /
+ hists->stats.total_period;

- if (!h->filtered)
+ if (!h->filtered && percent >= min_pcnt)
return nd;

nd = rb_next(nd);
@@ -875,6 +880,10 @@ static struct rb_node *hists__filter_prev_entries(struct rb_node *nd,
float percent = h->stat.period * 100.0 /
hists->stats.total_period;

+ if (callchain_param.mode == CHAIN_CUMULATIVE)
+ percent = h->stat_acc->period * 100.0 /
+ hists->stats.total_period;
+
if (!h->filtered && percent >= min_pcnt)
return nd;

diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 70ed0d5e1b94..b93302840cce 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -302,6 +302,10 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
if (h->filtered)
continue;

+ if (callchain_param.mode == CHAIN_CUMULATIVE)
+ percent = h->stat_acc->period * 100.0 /
+ hists->stats.total_period;
+
if (percent < min_pcnt)
continue;

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 302f08afd6a2..49db435f0cc2 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -496,6 +496,10 @@ print_entries:
if (h->filtered)
continue;

+ if (callchain_param.mode == CHAIN_CUMULATIVE)
+ percent = h->stat_acc->period * 100.0 /
+ hists->stats.total_period;
+
if (percent < min_pcnt)
continue;

--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/