aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/perf_counter/builtin-report.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 5d191216c80a..1a1028d3bc34 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -234,6 +234,13 @@ static int map__overlap(struct map *l, struct map *r)
234 return 0; 234 return 0;
235} 235}
236 236
237static size_t map__fprintf(struct map *self, FILE *fp)
238{
239 return fprintf(fp, " %lx-%lx %lx %s\n",
240 self->start, self->end, self->pgoff, self->dso->name);
241}
242
243
237struct thread { 244struct thread {
238 struct rb_node rb_node; 245 struct rb_node rb_node;
239 struct list_head maps; 246 struct list_head maps;
@@ -264,6 +271,18 @@ static int thread__set_comm(struct thread *self, const char *comm)
264 return self->comm ? 0 : -ENOMEM; 271 return self->comm ? 0 : -ENOMEM;
265} 272}
266 273
274static size_t thread__fprintf(struct thread *self, FILE *fp)
275{
276 struct map *pos;
277 size_t ret = fprintf(fp, "Thread %d %s\n", self->pid, self->comm);
278
279 list_for_each_entry(pos, &self->maps, node)
280 ret += map__fprintf(pos, fp);
281
282 return ret;
283}
284
285
267static struct rb_root threads; 286static struct rb_root threads;
268static struct thread *last_match; 287static struct thread *last_match;
269 288
@@ -355,6 +374,20 @@ static struct map *thread__find_map(struct thread *self, uint64_t ip)
355 return NULL; 374 return NULL;
356} 375}
357 376
377static size_t threads__fprintf(FILE *fp)
378{
379 size_t ret = 0;
380 struct rb_node *nd;
381
382 for (nd = rb_first(&threads); nd; nd = rb_next(nd)) {
383 struct thread *pos = rb_entry(nd, struct thread, rb_node);
384
385 ret += thread__fprintf(pos, fp);
386 }
387
388 return ret;
389}
390
358/* 391/*
359 * histogram, sorted on item, collects counts 392 * histogram, sorted on item, collects counts
360 */ 393 */
@@ -1126,6 +1159,9 @@ more:
1126 if (dump_trace) 1159 if (dump_trace)
1127 return 0; 1160 return 0;
1128 1161
1162 if (verbose >= 3)
1163 threads__fprintf(stdout);
1164
1129 if (verbose >= 2) 1165 if (verbose >= 2)
1130 dsos__fprintf(stdout); 1166 dsos__fprintf(stdout);
1131 1167