diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
| -rw-r--r-- | tools/perf/builtin-report.c | 72 |
1 files changed, 19 insertions, 53 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 9bd20c2ee3dd..01ef35cac5f9 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -30,7 +30,6 @@ | |||
| 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" | ||
| 34 | 33 | ||
| 35 | static char const *input_name = "perf.data"; | 34 | static char const *input_name = "perf.data"; |
| 36 | 35 | ||
| @@ -655,8 +654,7 @@ static int validate_chain(struct ip_callchain *chain, event_t *event) | |||
| 655 | return 0; | 654 | return 0; |
| 656 | } | 655 | } |
| 657 | 656 | ||
| 658 | static int | 657 | static int process_sample_event(event_t *event) |
| 659 | process_sample_event(event_t *event, unsigned long offset, unsigned long head) | ||
| 660 | { | 658 | { |
| 661 | char level; | 659 | char level; |
| 662 | struct symbol *sym = NULL; | 660 | struct symbol *sym = NULL; |
| @@ -673,9 +671,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
| 673 | more_data += sizeof(u64); | 671 | more_data += sizeof(u64); |
| 674 | } | 672 | } |
| 675 | 673 | ||
| 676 | dump_printf("%p [%p]: PERF_RECORD_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", | 674 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", |
| 677 | (void *)(offset + head), | ||
| 678 | (void *)(long)(event->header.size), | ||
| 679 | event->header.misc, | 675 | event->header.misc, |
| 680 | event->ip.pid, event->ip.tid, | 676 | event->ip.pid, event->ip.tid, |
| 681 | (void *)(long)ip, | 677 | (void *)(long)ip, |
| @@ -743,47 +739,27 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
| 743 | return -1; | 739 | return -1; |
| 744 | } | 740 | } |
| 745 | 741 | ||
| 746 | total += period; | 742 | event__stats.total += period; |
| 747 | 743 | ||
| 748 | return 0; | 744 | return 0; |
| 749 | } | 745 | } |
| 750 | 746 | ||
| 751 | static int | 747 | static int process_comm_event(event_t *event) |
| 752 | process_comm_event(event_t *event, unsigned long offset, unsigned long head) | ||
| 753 | { | 748 | { |
| 754 | struct thread *thread = threads__findnew(event->comm.pid); | 749 | struct thread *thread = threads__findnew(event->comm.pid); |
| 755 | 750 | ||
| 756 | dump_printf("%p [%p]: PERF_RECORD_COMM: %s:%d\n", | 751 | dump_printf(": %s:%d\n", event->comm.comm, event->comm.pid); |
| 757 | (void *)(offset + head), | ||
| 758 | (void *)(long)(event->header.size), | ||
| 759 | event->comm.comm, event->comm.pid); | ||
| 760 | 752 | ||
| 761 | if (thread == NULL || | 753 | if (thread == NULL || |
| 762 | thread__set_comm_adjust(thread, event->comm.comm)) { | 754 | thread__set_comm_adjust(thread, event->comm.comm)) { |
| 763 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); | 755 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); |
| 764 | return -1; | 756 | return -1; |
| 765 | } | 757 | } |
| 766 | total_comm++; | ||
| 767 | |||
| 768 | return 0; | ||
| 769 | } | ||
| 770 | |||
| 771 | static int | ||
| 772 | process_lost_event(event_t *event, unsigned long offset, unsigned long head) | ||
| 773 | { | ||
| 774 | dump_printf("%p [%p]: PERF_RECORD_LOST: id:%Ld: lost:%Ld\n", | ||
| 775 | (void *)(offset + head), | ||
| 776 | (void *)(long)(event->header.size), | ||
| 777 | event->lost.id, | ||
| 778 | event->lost.lost); | ||
| 779 | |||
| 780 | total_lost += event->lost.lost; | ||
| 781 | 758 | ||
| 782 | return 0; | 759 | return 0; |
| 783 | } | 760 | } |
| 784 | 761 | ||
| 785 | static int | 762 | static int process_read_event(event_t *event) |
| 786 | process_read_event(event_t *event, unsigned long offset, unsigned long head) | ||
| 787 | { | 763 | { |
| 788 | struct perf_event_attr *attr; | 764 | struct perf_event_attr *attr; |
| 789 | 765 | ||
| @@ -799,14 +775,9 @@ process_read_event(event_t *event, unsigned long offset, unsigned long head) | |||
| 799 | event->read.value); | 775 | event->read.value); |
| 800 | } | 776 | } |
| 801 | 777 | ||
| 802 | dump_printf("%p [%p]: PERF_RECORD_READ: %d %d %s %Lu\n", | 778 | dump_printf(": %d %d %s %Lu\n", event->read.pid, event->read.tid, |
| 803 | (void *)(offset + head), | 779 | attr ? __event_name(attr->type, attr->config) : "FAIL", |
| 804 | (void *)(long)(event->header.size), | 780 | event->read.value); |
| 805 | event->read.pid, | ||
| 806 | event->read.tid, | ||
| 807 | attr ? __event_name(attr->type, attr->config) | ||
| 808 | : "FAIL", | ||
| 809 | event->read.value); | ||
| 810 | 781 | ||
| 811 | return 0; | 782 | return 0; |
| 812 | } | 783 | } |
| @@ -842,11 +813,11 @@ static int sample_type_check(u64 type) | |||
| 842 | 813 | ||
| 843 | static struct perf_file_handler file_handler = { | 814 | static struct perf_file_handler file_handler = { |
| 844 | .process_sample_event = process_sample_event, | 815 | .process_sample_event = process_sample_event, |
| 845 | .process_mmap_event = process_mmap_event, | 816 | .process_mmap_event = event__process_mmap, |
| 846 | .process_comm_event = process_comm_event, | 817 | .process_comm_event = process_comm_event, |
| 847 | .process_exit_event = process_task_event, | 818 | .process_exit_event = event__process_task, |
| 848 | .process_fork_event = process_task_event, | 819 | .process_fork_event = event__process_task, |
| 849 | .process_lost_event = process_lost_event, | 820 | .process_lost_event = event__process_lost, |
| 850 | .process_read_event = process_read_event, | 821 | .process_read_event = process_read_event, |
| 851 | .sample_type_check = sample_type_check, | 822 | .sample_type_check = sample_type_check, |
| 852 | }; | 823 | }; |
| @@ -866,19 +837,14 @@ static int __cmd_report(void) | |||
| 866 | register_perf_file_handler(&file_handler); | 837 | register_perf_file_handler(&file_handler); |
| 867 | 838 | ||
| 868 | ret = mmap_dispatch_perf_file(&header, input_name, force, | 839 | ret = mmap_dispatch_perf_file(&header, input_name, force, |
| 869 | full_paths, &cwdlen, &cwd); | 840 | full_paths, &event__cwdlen, &event__cwd); |
| 870 | if (ret) | 841 | if (ret) |
| 871 | return ret; | 842 | return ret; |
| 872 | 843 | ||
| 873 | dump_printf(" IP events: %10ld\n", total); | 844 | if (dump_trace) { |
| 874 | dump_printf(" mmap events: %10ld\n", total_mmap); | 845 | event__print_totals(); |
| 875 | dump_printf(" comm events: %10ld\n", total_comm); | ||
| 876 | dump_printf(" fork events: %10ld\n", total_fork); | ||
| 877 | dump_printf(" lost events: %10ld\n", total_lost); | ||
| 878 | dump_printf(" unknown events: %10ld\n", file_handler.total_unknown); | ||
| 879 | |||
| 880 | if (dump_trace) | ||
| 881 | return 0; | 846 | return 0; |
| 847 | } | ||
| 882 | 848 | ||
| 883 | if (verbose > 3) | 849 | if (verbose > 3) |
| 884 | threads__fprintf(stdout); | 850 | threads__fprintf(stdout); |
| @@ -887,8 +853,8 @@ static int __cmd_report(void) | |||
| 887 | dsos__fprintf(stdout); | 853 | dsos__fprintf(stdout); |
| 888 | 854 | ||
| 889 | collapse__resort(); | 855 | collapse__resort(); |
| 890 | output__resort(total); | 856 | output__resort(event__stats.total); |
| 891 | output__fprintf(stdout, total); | 857 | output__fprintf(stdout, event__stats.total); |
| 892 | 858 | ||
| 893 | if (show_threads) | 859 | if (show_threads) |
| 894 | perf_read_values_destroy(&show_threads_values); | 860 | perf_read_values_destroy(&show_threads_values); |
