diff options
Diffstat (limited to 'Documentation/perf_counter/builtin-report.c')
-rw-r--r-- | Documentation/perf_counter/builtin-report.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c index 9da990fba4a5..6207a3147fcb 100644 --- a/Documentation/perf_counter/builtin-report.c +++ b/Documentation/perf_counter/builtin-report.c | |||
@@ -31,6 +31,8 @@ static int input; | |||
31 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 31 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
32 | 32 | ||
33 | static int dump_trace = 0; | 33 | static int dump_trace = 0; |
34 | #define dprintf(x...) do { if (dump_trace) printf(x); } while (0) | ||
35 | |||
34 | static int verbose; | 36 | static int verbose; |
35 | static int full_paths; | 37 | static int full_paths; |
36 | 38 | ||
@@ -729,14 +731,12 @@ more: | |||
729 | uint64_t ip = event->ip.ip; | 731 | uint64_t ip = event->ip.ip; |
730 | struct map *map = NULL; | 732 | struct map *map = NULL; |
731 | 733 | ||
732 | if (dump_trace) { | 734 | dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", |
733 | fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", | 735 | (void *)(offset + head), |
734 | (void *)(offset + head), | 736 | (void *)(long)(event->header.size), |
735 | (void *)(long)(event->header.size), | 737 | event->header.misc, |
736 | event->header.misc, | 738 | event->ip.pid, |
737 | event->ip.pid, | 739 | (void *)(long)ip); |
738 | (void *)(long)ip); | ||
739 | } | ||
740 | 740 | ||
741 | if (thread == NULL) { | 741 | if (thread == NULL) { |
742 | fprintf(stderr, "problem processing %d event, skipping it.\n", | 742 | fprintf(stderr, "problem processing %d event, skipping it.\n", |
@@ -781,15 +781,14 @@ more: | |||
781 | struct thread *thread = threads__findnew(event->mmap.pid); | 781 | struct thread *thread = threads__findnew(event->mmap.pid); |
782 | struct map *map = map__new(&event->mmap, cwdp, cwdlen); | 782 | struct map *map = map__new(&event->mmap, cwdp, cwdlen); |
783 | 783 | ||
784 | if (dump_trace) { | 784 | dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n", |
785 | fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n", | 785 | (void *)(offset + head), |
786 | (void *)(offset + head), | 786 | (void *)(long)(event->header.size), |
787 | (void *)(long)(event->header.size), | 787 | (void *)(long)event->mmap.start, |
788 | (void *)(long)event->mmap.start, | 788 | (void *)(long)event->mmap.len, |
789 | (void *)(long)event->mmap.len, | 789 | (void *)(long)event->mmap.pgoff, |
790 | (void *)(long)event->mmap.pgoff, | 790 | event->mmap.filename); |
791 | event->mmap.filename); | 791 | |
792 | } | ||
793 | if (thread == NULL || map == NULL) { | 792 | if (thread == NULL || map == NULL) { |
794 | if (verbose) | 793 | if (verbose) |
795 | fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n"); | 794 | fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n"); |
@@ -802,12 +801,11 @@ more: | |||
802 | case PERF_EVENT_COMM: { | 801 | case PERF_EVENT_COMM: { |
803 | struct thread *thread = threads__findnew(event->comm.pid); | 802 | struct thread *thread = threads__findnew(event->comm.pid); |
804 | 803 | ||
805 | if (dump_trace) { | 804 | dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n", |
806 | fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n", | 805 | (void *)(offset + head), |
807 | (void *)(offset + head), | 806 | (void *)(long)(event->header.size), |
808 | (void *)(long)(event->header.size), | 807 | event->comm.comm, event->comm.pid); |
809 | event->comm.comm, event->comm.pid); | 808 | |
810 | } | ||
811 | if (thread == NULL || | 809 | if (thread == NULL || |
812 | thread__set_comm(thread, event->comm.comm)) { | 810 | thread__set_comm(thread, event->comm.comm)) { |
813 | fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n"); | 811 | fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n"); |
@@ -818,11 +816,10 @@ more: | |||
818 | } | 816 | } |
819 | default: { | 817 | default: { |
820 | broken_event: | 818 | broken_event: |
821 | if (dump_trace) | 819 | dprintf("%p [%p]: skipping unknown header type: %d\n", |
822 | fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n", | 820 | (void *)(offset + head), |
823 | (void *)(offset + head), | 821 | (void *)(long)(event->header.size), |
824 | (void *)(long)(event->header.size), | 822 | event->header.type); |
825 | event->header.type); | ||
826 | 823 | ||
827 | total_unknown++; | 824 | total_unknown++; |
828 | 825 | ||
@@ -846,14 +843,13 @@ broken_event: | |||
846 | rc = EXIT_SUCCESS; | 843 | rc = EXIT_SUCCESS; |
847 | close(input); | 844 | close(input); |
848 | 845 | ||
849 | if (dump_trace) { | 846 | dprintf(" IP events: %10ld\n", total); |
850 | fprintf(stderr, " IP events: %10ld\n", total); | 847 | dprintf(" mmap events: %10ld\n", total_mmap); |
851 | fprintf(stderr, " mmap events: %10ld\n", total_mmap); | 848 | dprintf(" comm events: %10ld\n", total_comm); |
852 | fprintf(stderr, " comm events: %10ld\n", total_comm); | 849 | dprintf(" unknown events: %10ld\n", total_unknown); |
853 | fprintf(stderr, " unknown events: %10ld\n", total_unknown); | ||
854 | 850 | ||
851 | if (dump_trace) | ||
855 | return 0; | 852 | return 0; |
856 | } | ||
857 | 853 | ||
858 | if (verbose >= 2) | 854 | if (verbose >= 2) |
859 | dsos__fprintf(stdout); | 855 | dsos__fprintf(stdout); |