Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233259
b: refs/heads/master
c: 401b8e1
h: refs/heads/master
i:
  233257: 44865b1
  233255: cb3ace8
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Feb 10, 2011
1 parent 606f9c1 commit 9b4e533
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5651f7f47dbb1cf2b95a60582546db4ff508e2b4
refs/heads/master: 401b8e1317d288f28d6e1afd13271dcb08fd9869
4 changes: 2 additions & 2 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ static int __cmd_record(int argc, const char **argv)
perf_session__process_machines(session, event__synthesize_guest_os);

if (!system_wide)
event__synthesize_thread(target_tid, process_synthesized_event,
session);
event__synthesize_thread_map(threads, process_synthesized_event,
session);
else
event__synthesize_threads(process_synthesized_event, session);

Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ static int __cmd_top(void)
return -ENOMEM;

if (target_tid != -1)
event__synthesize_thread(target_tid, event__process, session);
event__synthesize_thread_map(threads, event__process, session);
else
event__synthesize_threads(event__process, session);

Expand Down
18 changes: 13 additions & 5 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ static int __event__synthesize_thread(event_t *comm_event, event_t *mmap_event,
process, session);
}

int event__synthesize_thread(pid_t pid, event__handler_t process,
struct perf_session *session)
int event__synthesize_thread_map(struct thread_map *threads,
event__handler_t process,
struct perf_session *session)
{
event_t *comm_event, *mmap_event;
int err = -1;
int err = -1, thread;

comm_event = malloc(sizeof(comm_event->comm) + session->id_hdr_size);
if (comm_event == NULL)
Expand All @@ -277,8 +278,15 @@ int event__synthesize_thread(pid_t pid, event__handler_t process,
if (mmap_event == NULL)
goto out_free_comm;

err = __event__synthesize_thread(comm_event, mmap_event, pid,
process, session);
err = 0;
for (thread = 0; thread < threads->nr; ++thread) {
if (__event__synthesize_thread(comm_event, mmap_event,
threads->map[thread],
process, session)) {
err = -1;
break;
}
}
free(mmap_event);
out_free_comm:
free(comm_event);
Expand Down
6 changes: 4 additions & 2 deletions trunk/tools/perf/util/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ typedef union event_union {
void event__print_totals(void);

struct perf_session;
struct thread_map;

typedef int (*event__handler_synth_t)(event_t *event,
struct perf_session *session);
typedef int (*event__handler_t)(event_t *event, struct sample_data *sample,
struct perf_session *session);

int event__synthesize_thread(pid_t pid, event__handler_t process,
struct perf_session *session);
int event__synthesize_thread_map(struct thread_map *threads,
event__handler_t process,
struct perf_session *session);
int event__synthesize_threads(event__handler_t process,
struct perf_session *session);
int event__synthesize_kernel_mmap(event__handler_t process,
Expand Down

0 comments on commit 9b4e533

Please sign in to comment.