diff options
-rw-r--r-- | tools/perf/builtin-report.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index b20a4b6e31b7..95fd06cdaa99 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -99,6 +99,7 @@ struct comm_event { | |||
99 | struct fork_event { | 99 | struct fork_event { |
100 | struct perf_event_header header; | 100 | struct perf_event_header header; |
101 | u32 pid, ppid; | 101 | u32 pid, ppid; |
102 | u32 tid, ptid; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | struct lost_event { | 105 | struct lost_event { |
@@ -1608,15 +1609,27 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head) | |||
1608 | } | 1609 | } |
1609 | 1610 | ||
1610 | static int | 1611 | static int |
1611 | process_fork_event(event_t *event, unsigned long offset, unsigned long head) | 1612 | process_task_event(event_t *event, unsigned long offset, unsigned long head) |
1612 | { | 1613 | { |
1613 | struct thread *thread = threads__findnew(event->fork.pid); | 1614 | struct thread *thread = threads__findnew(event->fork.pid); |
1614 | struct thread *parent = threads__findnew(event->fork.ppid); | 1615 | struct thread *parent = threads__findnew(event->fork.ppid); |
1615 | 1616 | ||
1616 | dprintf("%p [%p]: PERF_EVENT_FORK: %d:%d\n", | 1617 | dprintf("%p [%p]: PERF_EVENT_%s: (%d:%d):(%d:%d)\n", |
1617 | (void *)(offset + head), | 1618 | (void *)(offset + head), |
1618 | (void *)(long)(event->header.size), | 1619 | (void *)(long)(event->header.size), |
1619 | event->fork.pid, event->fork.ppid); | 1620 | event->header.type == PERF_EVENT_FORK ? "FORK" : "EXIT", |
1621 | event->fork.pid, event->fork.tid, | ||
1622 | event->fork.ppid, event->fork.ptid); | ||
1623 | |||
1624 | /* | ||
1625 | * A thread clone will have the same PID for both | ||
1626 | * parent and child. | ||
1627 | */ | ||
1628 | if (thread == parent) | ||
1629 | return 0; | ||
1630 | |||
1631 | if (event->header.type == PERF_EVENT_EXIT) | ||
1632 | return 0; | ||
1620 | 1633 | ||
1621 | if (!thread || !parent || thread__fork(thread, parent)) { | 1634 | if (!thread || !parent || thread__fork(thread, parent)) { |
1622 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); | 1635 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); |
@@ -1706,7 +1719,8 @@ process_event(event_t *event, unsigned long offset, unsigned long head) | |||
1706 | return process_comm_event(event, offset, head); | 1719 | return process_comm_event(event, offset, head); |
1707 | 1720 | ||
1708 | case PERF_EVENT_FORK: | 1721 | case PERF_EVENT_FORK: |
1709 | return process_fork_event(event, offset, head); | 1722 | case PERF_EVENT_EXIT: |
1723 | return process_task_event(event, offset, head); | ||
1710 | 1724 | ||
1711 | case PERF_EVENT_LOST: | 1725 | case PERF_EVENT_LOST: |
1712 | return process_lost_event(event, offset, head); | 1726 | return process_lost_event(event, offset, head); |