aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/hists_common.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-05-11 21:06:18 -0400
committerJiri Olsa <jolsa@kernel.org>2014-05-21 05:45:37 -0400
commit4e754e1c7fe02e6b104e61f7e06e9895527e8ad3 (patch)
tree22ace85da5cb4d4914f8204bbc90a3eead4886a8 /tools/perf/tests/hists_common.c
parent1c89fe9b0447f0ce393325e51911f8073432b7b4 (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_common.c')
-rw-r--r--tools/perf/tests/hists_common.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 44655b395bb9..040a85b17aee 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -146,3 +146,60 @@ out:
146 machine__delete(machine); 146 machine__delete(machine);
147 return NULL; 147 return NULL;
148} 148}
149
150void print_hists_in(struct hists *hists)
151{
152 int i = 0;
153 struct rb_root *root;
154 struct rb_node *node;
155
156 if (sort__need_collapse)
157 root = &hists->entries_collapsed;
158 else
159 root = hists->entries_in;
160
161 pr_info("----- %s --------\n", __func__);
162 node = rb_first(root);
163 while (node) {
164 struct hist_entry *he;
165
166 he = rb_entry(node, struct hist_entry, rb_node_in);
167
168 if (!he->filtered) {
169 pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
170 i, thread__comm_str(he->thread),
171 he->ms.map->dso->short_name,
172 he->ms.sym->name, he->stat.period);
173 }
174
175 i++;
176 node = rb_next(node);
177 }
178}
179
180void print_hists_out(struct hists *hists)
181{
182 int i = 0;
183 struct rb_root *root;
184 struct rb_node *node;
185
186 root = &hists->entries;
187
188 pr_info("----- %s --------\n", __func__);
189 node = rb_first(root);
190 while (node) {
191 struct hist_entry *he;
192
193 he = rb_entry(node, struct hist_entry, rb_node);
194
195 if (!he->filtered) {
196 pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
197 i, thread__comm_str(he->thread),
198 he->ms.map->dso->short_name,
199 he->ms.sym->name, he->stat.period);
200 }
201
202 i++;
203 node = rb_next(node);
204 }
205}