diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/event.c | 18 | ||||
-rw-r--r-- | tools/perf/util/event.h | 6 |
4 files changed, 20 insertions, 10 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index b2f729fdb317..60cac6f92e8b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -759,8 +759,8 @@ static int __cmd_record(int argc, const char **argv) | |||
759 | perf_session__process_machines(session, event__synthesize_guest_os); | 759 | perf_session__process_machines(session, event__synthesize_guest_os); |
760 | 760 | ||
761 | if (!system_wide) | 761 | if (!system_wide) |
762 | event__synthesize_thread(target_tid, process_synthesized_event, | 762 | event__synthesize_thread_map(threads, process_synthesized_event, |
763 | session); | 763 | session); |
764 | else | 764 | else |
765 | event__synthesize_threads(process_synthesized_event, session); | 765 | event__synthesize_threads(process_synthesized_event, session); |
766 | 766 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index b6998e055767..5a29d9cd9486 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -1306,7 +1306,7 @@ static int __cmd_top(void) | |||
1306 | return -ENOMEM; | 1306 | return -ENOMEM; |
1307 | 1307 | ||
1308 | if (target_tid != -1) | 1308 | if (target_tid != -1) |
1309 | event__synthesize_thread(target_tid, event__process, session); | 1309 | event__synthesize_thread_map(threads, event__process, session); |
1310 | else | 1310 | else |
1311 | event__synthesize_threads(event__process, session); | 1311 | event__synthesize_threads(event__process, session); |
1312 | 1312 | ||
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 1478ab4ee222..50d0a931497a 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -263,11 +263,12 @@ static int __event__synthesize_thread(event_t *comm_event, event_t *mmap_event, | |||
263 | process, session); | 263 | process, session); |
264 | } | 264 | } |
265 | 265 | ||
266 | int event__synthesize_thread(pid_t pid, event__handler_t process, | 266 | int event__synthesize_thread_map(struct thread_map *threads, |
267 | struct perf_session *session) | 267 | event__handler_t process, |
268 | struct perf_session *session) | ||
268 | { | 269 | { |
269 | event_t *comm_event, *mmap_event; | 270 | event_t *comm_event, *mmap_event; |
270 | int err = -1; | 271 | int err = -1, thread; |
271 | 272 | ||
272 | comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size); | 273 | comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size); |
273 | if (comm_event == NULL) | 274 | if (comm_event == NULL) |
@@ -277,8 +278,15 @@ int event__synthesize_thread(pid_t pid, event__handler_t process, | |||
277 | if (mmap_event == NULL) | 278 | if (mmap_event == NULL) |
278 | goto out_free_comm; | 279 | goto out_free_comm; |
279 | 280 | ||
280 | err = __event__synthesize_thread(comm_event, mmap_event, pid, | 281 | err = 0; |
281 | process, session); | 282 | for (thread = 0; thread < threads->nr; ++thread) { |
283 | if (__event__synthesize_thread(comm_event, mmap_event, | ||
284 | threads->map[thread], | ||
285 | process, session)) { | ||
286 | err = -1; | ||
287 | break; | ||
288 | } | ||
289 | } | ||
282 | free(mmap_event); | 290 | free(mmap_event); |
283 | out_free_comm: | 291 | out_free_comm: |
284 | free(comm_event); | 292 | free(comm_event); |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 2b7e91902f10..cc7b52f9b492 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -135,14 +135,16 @@ typedef union event_union { | |||
135 | void event__print_totals(void); | 135 | void event__print_totals(void); |
136 | 136 | ||
137 | struct perf_session; | 137 | struct perf_session; |
138 | struct thread_map; | ||
138 | 139 | ||
139 | typedef int (*event__handler_synth_t)(event_t *event, | 140 | typedef int (*event__handler_synth_t)(event_t *event, |
140 | struct perf_session *session); | 141 | struct perf_session *session); |
141 | typedef int (*event__handler_t)(event_t *event, struct sample_data *sample, | 142 | typedef int (*event__handler_t)(event_t *event, struct sample_data *sample, |
142 | struct perf_session *session); | 143 | struct perf_session *session); |
143 | 144 | ||
144 | int event__synthesize_thread(pid_t pid, event__handler_t process, | 145 | int event__synthesize_thread_map(struct thread_map *threads, |
145 | struct perf_session *session); | 146 | event__handler_t process, |
147 | struct perf_session *session); | ||
146 | int event__synthesize_threads(event__handler_t process, | 148 | int event__synthesize_threads(event__handler_t process, |
147 | struct perf_session *session); | 149 | struct perf_session *session); |
148 | int event__synthesize_kernel_mmap(event__handler_t process, | 150 | int event__synthesize_kernel_mmap(event__handler_t process, |