[PATCH 13/22] perf tools: Factor hpp_arg struct to carry hist_browser

From: Jiri Olsa
Date: Sun Feb 02 2014 - 16:40:24 EST


The hpp_arg struct is used within the hist browser
specific code, so it could pass the hist_browser
struct itself.

We'll need access to hist browser struct within
__hpp__color_fmt function in following patch.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 9a95fdc..3dd71d6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -574,7 +574,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
}

struct hpp_arg {
- struct ui_browser *b;
+ struct hist_browser *hb;
char folded_sign;
bool current_entry;
};
@@ -600,7 +600,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,
if (hists->stats.total_period)
percent = 100.0 * get_field(he) / hists->stats.total_period;

- ui_browser__set_percent_color(arg->b, percent, arg->current_entry);
+ ui_browser__set_percent_color(&arg->hb->b, percent, arg->current_entry);

if (callchain_cb)
ret += callchain_cb(arg);
@@ -634,7 +634,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,
* zero-fill group members in the middle which
* have no sample
*/
- ui_browser__set_percent_color(arg->b, 0.0,
+ ui_browser__set_percent_color(&arg->hb->b, 0.0,
arg->current_entry);
ret += scnprintf(hpp->buf, hpp->size,
" %6.2f%%", 0.0);
@@ -642,7 +642,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,
}

percent = 100.0 * period / total;
- ui_browser__set_percent_color(arg->b, percent,
+ ui_browser__set_percent_color(&arg->hb->b, percent,
arg->current_entry);
ret += scnprintf(hpp->buf, hpp->size,
" %6.2f%%", percent);
@@ -657,7 +657,7 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,
/*
* zero-fill group members at last which have no sample
*/
- ui_browser__set_percent_color(arg->b, 0.0,
+ ui_browser__set_percent_color(&arg->hb->b, 0.0,
arg->current_entry);
ret += scnprintf(hpp->buf, hpp->size,
" %6.2f%%", 0.0);
@@ -665,8 +665,8 @@ static int __hpp__color_fmt(struct perf_hpp *hpp, struct hist_entry *he,
}
}
out:
- if (!arg->current_entry || !arg->b->navkeypressed)
- ui_browser__set_color(arg->b, HE_COLORSET_NORMAL);
+ if (!arg->current_entry || !arg->hb->b.navkeypressed)
+ ui_browser__set_color(&arg->hb->b, HE_COLORSET_NORMAL);

return ret;
}
@@ -751,7 +751,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,

if (row_offset == 0) {
struct hpp_arg arg = {
- .b = &browser->b,
+ .hb = browser,
.folded_sign = folded_sign,
.current_entry = current_entry,
};
--
1.8.3.1

--
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/