diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-05-11 21:06:18 -0400 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-21 05:45:37 -0400 |
commit | 4e754e1c7fe02e6b104e61f7e06e9895527e8ad3 (patch) | |
tree | 22ace85da5cb4d4914f8204bbc90a3eead4886a8 /tools/perf/tests/hists_link.c | |
parent | 1c89fe9b0447f0ce393325e51911f8073432b7b4 (diff) |
perf tests: Factor out print_hists_*()
Those print helper functions can be reused by later hist test cases so
factor them out to a common location.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-20-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/tests/hists_link.c')
-rw-r--r-- | tools/perf/tests/hists_link.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index b009bbf440d9..4e783db60bba 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
@@ -268,33 +268,6 @@ static int validate_link(struct hists *leader, struct hists *other) | |||
268 | return __validate_link(leader, 0) || __validate_link(other, 1); | 268 | return __validate_link(leader, 0) || __validate_link(other, 1); |
269 | } | 269 | } |
270 | 270 | ||
271 | static void print_hists(struct hists *hists) | ||
272 | { | ||
273 | int i = 0; | ||
274 | struct rb_root *root; | ||
275 | struct rb_node *node; | ||
276 | |||
277 | if (sort__need_collapse) | ||
278 | root = &hists->entries_collapsed; | ||
279 | else | ||
280 | root = hists->entries_in; | ||
281 | |||
282 | pr_info("----- %s --------\n", __func__); | ||
283 | node = rb_first(root); | ||
284 | while (node) { | ||
285 | struct hist_entry *he; | ||
286 | |||
287 | he = rb_entry(node, struct hist_entry, rb_node_in); | ||
288 | |||
289 | pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n", | ||
290 | i, thread__comm_str(he->thread), he->ms.map->dso->short_name, | ||
291 | he->ms.sym->name, he->stat.period); | ||
292 | |||
293 | i++; | ||
294 | node = rb_next(node); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | int test__hists_link(void) | 271 | int test__hists_link(void) |
299 | { | 272 | { |
300 | int err = -1; | 273 | int err = -1; |
@@ -336,7 +309,7 @@ int test__hists_link(void) | |||
336 | hists__collapse_resort(&evsel->hists, NULL); | 309 | hists__collapse_resort(&evsel->hists, NULL); |
337 | 310 | ||
338 | if (verbose > 2) | 311 | if (verbose > 2) |
339 | print_hists(&evsel->hists); | 312 | print_hists_in(&evsel->hists); |
340 | } | 313 | } |
341 | 314 | ||
342 | first = perf_evlist__first(evlist); | 315 | first = perf_evlist__first(evlist); |