Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277351
b: refs/heads/master
c: defd8d3
h: refs/heads/master
i:
  277349: 49fbe3f
  277347: b02ac95
  277343: 920aa64
v: v3
  • Loading branch information
David Ahern authored and Arnaldo Carvalho de Melo committed Dec 23, 2011
1 parent 7fc861d commit fc9dc04
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 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: fb2baceb5a64990163e93b77ee205d0173202ee6
refs/heads/master: defd8d38773cf9e01c69a903d04d5895b78ee74f
37 changes: 32 additions & 5 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,12 @@ int perf_event__synthesize_modules(struct perf_tool *tool,

static int __event__synthesize_thread(union perf_event *comm_event,
union perf_event *mmap_event,
pid_t pid, perf_event__handler_t process,
pid_t pid, int full,
perf_event__handler_t process,
struct perf_tool *tool,
struct machine *machine)
{
pid_t tgid = perf_event__synthesize_comm(tool, comm_event, pid, 1,
pid_t tgid = perf_event__synthesize_comm(tool, comm_event, pid, full,
process, machine);
if (tgid == -1)
return -1;
Expand All @@ -279,7 +280,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
struct machine *machine)
{
union perf_event *comm_event, *mmap_event;
int err = -1, thread;
int err = -1, thread, j;

comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size);
if (comm_event == NULL)
Expand All @@ -292,11 +293,37 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
err = 0;
for (thread = 0; thread < threads->nr; ++thread) {
if (__event__synthesize_thread(comm_event, mmap_event,
threads->map[thread],
threads->map[thread], 0,
process, tool, machine)) {
err = -1;
break;
}

/*
* comm.pid is set to thread group id by
* perf_event__synthesize_comm
*/
if ((int) comm_event->comm.pid != threads->map[thread]) {
bool need_leader = true;

/* is thread group leader in thread_map? */
for (j = 0; j < threads->nr; ++j) {
if ((int) comm_event->comm.pid == threads->map[j]) {
need_leader = false;
break;
}
}

/* if not, generate events for it */
if (need_leader &&
__event__synthesize_thread(comm_event,
mmap_event,
comm_event->comm.pid, 0,
process, tool, machine)) {
err = -1;
break;
}
}
}
free(mmap_event);
out_free_comm:
Expand Down Expand Up @@ -333,7 +360,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
if (*end) /* only interested in proper numerical dirents */
continue;

__event__synthesize_thread(comm_event, mmap_event, pid,
__event__synthesize_thread(comm_event, mmap_event, pid, 1,
process, tool, machine);
}

Expand Down

0 comments on commit fc9dc04

Please sign in to comment.