Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156259
b: refs/heads/master
c: 27d028d
h: refs/heads/master
i:
  156257: 8dd20c2
  156255: 38a3f6c
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 2, 2009
1 parent b87ab9d commit 312e6f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 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: 9f498cc5be7e013d8d6e4c616980ed0ffc8680d2
refs/heads/master: 27d028de64bd7e1f8e72bdeae6b0586939574fcb
22 changes: 18 additions & 4 deletions trunk/tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct comm_event {
struct fork_event {
struct perf_event_header header;
u32 pid, ppid;
u32 tid, ptid;
};

struct lost_event {
Expand Down Expand Up @@ -1608,15 +1609,27 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
}

static int
process_fork_event(event_t *event, unsigned long offset, unsigned long head)
process_task_event(event_t *event, unsigned long offset, unsigned long head)
{
struct thread *thread = threads__findnew(event->fork.pid);
struct thread *parent = threads__findnew(event->fork.ppid);

dprintf("%p [%p]: PERF_EVENT_FORK: %d:%d\n",
dprintf("%p [%p]: PERF_EVENT_%s: (%d:%d):(%d:%d)\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->fork.pid, event->fork.ppid);
event->header.type == PERF_EVENT_FORK ? "FORK" : "EXIT",
event->fork.pid, event->fork.tid,
event->fork.ppid, event->fork.ptid);

/*
* A thread clone will have the same PID for both
* parent and child.
*/
if (thread == parent)
return 0;

if (event->header.type == PERF_EVENT_EXIT)
return 0;

if (!thread || !parent || thread__fork(thread, parent)) {
dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
Expand Down Expand Up @@ -1706,7 +1719,8 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
return process_comm_event(event, offset, head);

case PERF_EVENT_FORK:
return process_fork_event(event, offset, head);
case PERF_EVENT_EXIT:
return process_task_event(event, offset, head);

case PERF_EVENT_LOST:
return process_lost_event(event, offset, head);
Expand Down

0 comments on commit 312e6f4

Please sign in to comment.