aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c63
1 files changed, 1 insertions, 62 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index fe474b7f8ad0..1826be719b58 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -30,6 +30,7 @@
30#include "util/thread.h" 30#include "util/thread.h"
31#include "util/sort.h" 31#include "util/sort.h"
32#include "util/hist.h" 32#include "util/hist.h"
33#include "util/process_events.h"
33 34
34static char const *input_name = "perf.data"; 35static char const *input_name = "perf.data";
35 36
@@ -54,9 +55,6 @@ static int exclude_other = 1;
54static char callchain_default_opt[] = "fractal,0.5"; 55static char callchain_default_opt[] = "fractal,0.5";
55const char *vmlinux_name; 56const char *vmlinux_name;
56 57
57static char *cwd;
58static int cwdlen;
59
60static struct perf_header *header; 58static struct perf_header *header;
61 59
62static u64 sample_type; 60static u64 sample_type;
@@ -751,33 +749,6 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
751} 749}
752 750
753static int 751static int
754process_mmap_event(event_t *event, unsigned long offset, unsigned long head)
755{
756 struct map *map = map__new(&event->mmap, cwd, cwdlen);
757 struct thread *thread = threads__findnew(event->mmap.pid);
758
759 dump_printf("%p [%p]: PERF_RECORD_MMAP %d/%d: [%p(%p) @ %p]: %s\n",
760 (void *)(offset + head),
761 (void *)(long)(event->header.size),
762 event->mmap.pid,
763 event->mmap.tid,
764 (void *)(long)event->mmap.start,
765 (void *)(long)event->mmap.len,
766 (void *)(long)event->mmap.pgoff,
767 event->mmap.filename);
768
769 if (thread == NULL || map == NULL) {
770 dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
771 return 0;
772 }
773
774 thread__insert_map(thread, map);
775 total_mmap++;
776
777 return 0;
778}
779
780static int
781process_comm_event(event_t *event, unsigned long offset, unsigned long head) 752process_comm_event(event_t *event, unsigned long offset, unsigned long head)
782{ 753{
783 struct thread *thread = threads__findnew(event->comm.pid); 754 struct thread *thread = threads__findnew(event->comm.pid);
@@ -798,38 +769,6 @@ process_comm_event(event_t *event, unsigned long offset, unsigned long head)
798} 769}
799 770
800static int 771static int
801process_task_event(event_t *event, unsigned long offset, unsigned long head)
802{
803 struct thread *thread = threads__findnew(event->fork.pid);
804 struct thread *parent = threads__findnew(event->fork.ppid);
805
806 dump_printf("%p [%p]: PERF_RECORD_%s: (%d:%d):(%d:%d)\n",
807 (void *)(offset + head),
808 (void *)(long)(event->header.size),
809 event->header.type == PERF_RECORD_FORK ? "FORK" : "EXIT",
810 event->fork.pid, event->fork.tid,
811 event->fork.ppid, event->fork.ptid);
812
813 /*
814 * A thread clone will have the same PID for both
815 * parent and child.
816 */
817 if (thread == parent)
818 return 0;
819
820 if (event->header.type == PERF_RECORD_EXIT)
821 return 0;
822
823 if (!thread || !parent || thread__fork(thread, parent)) {
824 dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
825 return -1;
826 }
827 total_fork++;
828
829 return 0;
830}
831
832static int
833process_lost_event(event_t *event, unsigned long offset, unsigned long head) 772process_lost_event(event_t *event, unsigned long offset, unsigned long head)
834{ 773{
835 dump_printf("%p [%p]: PERF_RECORD_LOST: id:%Ld: lost:%Ld\n", 774 dump_printf("%p [%p]: PERF_RECORD_LOST: id:%Ld: lost:%Ld\n",