diff options
Diffstat (limited to 'tools/perf/util/event.h')
-rw-r--r-- | tools/perf/util/event.h | 149 |
1 files changed, 31 insertions, 118 deletions
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 0e164e8ae28d..429a3fe52d6c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -7,108 +7,26 @@ | |||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/bpf.h> | 8 | #include <linux/bpf.h> |
9 | #include <linux/perf_event.h> | 9 | #include <linux/perf_event.h> |
10 | #include <perf/event.h> | ||
10 | 11 | ||
11 | #include "../perf.h" | 12 | #include "../perf.h" |
12 | #include "build-id.h" | 13 | #include "build-id.h" |
13 | #include "perf_regs.h" | 14 | #include "perf_regs.h" |
14 | 15 | ||
15 | struct mmap_event { | 16 | #ifdef __LP64__ |
16 | struct perf_event_header header; | ||
17 | u32 pid, tid; | ||
18 | u64 start; | ||
19 | u64 len; | ||
20 | u64 pgoff; | ||
21 | char filename[PATH_MAX]; | ||
22 | }; | ||
23 | |||
24 | struct mmap2_event { | ||
25 | struct perf_event_header header; | ||
26 | u32 pid, tid; | ||
27 | u64 start; | ||
28 | u64 len; | ||
29 | u64 pgoff; | ||
30 | u32 maj; | ||
31 | u32 min; | ||
32 | u64 ino; | ||
33 | u64 ino_generation; | ||
34 | u32 prot; | ||
35 | u32 flags; | ||
36 | char filename[PATH_MAX]; | ||
37 | }; | ||
38 | |||
39 | struct comm_event { | ||
40 | struct perf_event_header header; | ||
41 | u32 pid, tid; | ||
42 | char comm[16]; | ||
43 | }; | ||
44 | |||
45 | struct namespaces_event { | ||
46 | struct perf_event_header header; | ||
47 | u32 pid, tid; | ||
48 | u64 nr_namespaces; | ||
49 | struct perf_ns_link_info link_info[]; | ||
50 | }; | ||
51 | |||
52 | struct fork_event { | ||
53 | struct perf_event_header header; | ||
54 | u32 pid, ppid; | ||
55 | u32 tid, ptid; | ||
56 | u64 time; | ||
57 | }; | ||
58 | |||
59 | struct lost_event { | ||
60 | struct perf_event_header header; | ||
61 | u64 id; | ||
62 | u64 lost; | ||
63 | }; | ||
64 | |||
65 | struct lost_samples_event { | ||
66 | struct perf_event_header header; | ||
67 | u64 lost; | ||
68 | }; | ||
69 | |||
70 | /* | 17 | /* |
71 | * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID | 18 | * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining |
19 | * __u64 as long long unsigned int, and then -Werror=format= kicks in and | ||
20 | * complains of the mismatched types, so use these two special extra PRI | ||
21 | * macros to overcome that. | ||
72 | */ | 22 | */ |
73 | struct read_event { | 23 | #define PRI_lu64 "l" PRIu64 |
74 | struct perf_event_header header; | 24 | #define PRI_lx64 "l" PRIx64 |
75 | u32 pid, tid; | 25 | #else |
76 | u64 value; | 26 | #define PRI_lu64 PRIu64 |
77 | u64 time_enabled; | 27 | #define PRI_lx64 PRIx64 |
78 | u64 time_running; | ||
79 | u64 id; | ||
80 | }; | ||
81 | |||
82 | struct throttle_event { | ||
83 | struct perf_event_header header; | ||
84 | u64 time; | ||
85 | u64 id; | ||
86 | u64 stream_id; | ||
87 | }; | ||
88 | |||
89 | #ifndef KSYM_NAME_LEN | ||
90 | #define KSYM_NAME_LEN 256 | ||
91 | #endif | 28 | #endif |
92 | 29 | ||
93 | struct ksymbol_event { | ||
94 | struct perf_event_header header; | ||
95 | u64 addr; | ||
96 | u32 len; | ||
97 | u16 ksym_type; | ||
98 | u16 flags; | ||
99 | char name[KSYM_NAME_LEN]; | ||
100 | }; | ||
101 | |||
102 | struct bpf_event { | ||
103 | struct perf_event_header header; | ||
104 | u16 type; | ||
105 | u16 flags; | ||
106 | u32 id; | ||
107 | |||
108 | /* for bpf_prog types */ | ||
109 | u8 tag[BPF_TAG_SIZE]; // prog tag | ||
110 | }; | ||
111 | |||
112 | #define PERF_SAMPLE_MASK \ | 30 | #define PERF_SAMPLE_MASK \ |
113 | (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ | 31 | (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ |
114 | PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ | 32 | PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ |
@@ -119,11 +37,6 @@ struct bpf_event { | |||
119 | /* perf sample has 16 bits size limit */ | 37 | /* perf sample has 16 bits size limit */ |
120 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) | 38 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) |
121 | 39 | ||
122 | struct sample_event { | ||
123 | struct perf_event_header header; | ||
124 | u64 array[]; | ||
125 | }; | ||
126 | |||
127 | struct regs_dump { | 40 | struct regs_dump { |
128 | u64 abi; | 41 | u64 abi; |
129 | u64 mask; | 42 | u64 mask; |
@@ -392,18 +305,18 @@ static inline void *perf_synth__raw_data(void *p) | |||
392 | * when possible sends this number in a PERF_RECORD_LOST event. The number of | 305 | * when possible sends this number in a PERF_RECORD_LOST event. The number of |
393 | * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while | 306 | * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while |
394 | * total_lost tells exactly how many events the kernel in fact lost, i.e. it is | 307 | * total_lost tells exactly how many events the kernel in fact lost, i.e. it is |
395 | * the sum of all struct lost_event.lost fields reported. | 308 | * the sum of all struct perf_record_lost.lost fields reported. |
396 | * | 309 | * |
397 | * The kernel discards mixed up samples and sends the number in a | 310 | * The kernel discards mixed up samples and sends the number in a |
398 | * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored | 311 | * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored |
399 | * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells | 312 | * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells |
400 | * exactly how many samples the kernel in fact dropped, i.e. it is the sum of | 313 | * exactly how many samples the kernel in fact dropped, i.e. it is the sum of |
401 | * all struct lost_samples_event.lost fields reported. | 314 | * all struct perf_record_lost_samples.lost fields reported. |
402 | * | 315 | * |
403 | * The total_period is needed because by default auto-freq is used, so | 316 | * The total_period is needed because by default auto-freq is used, so |
404 | * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get | 317 | * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get |
405 | * the total number of low level events, it is necessary to to sum all struct | 318 | * the total number of low level events, it is necessary to to sum all struct |
406 | * sample_event.period and stash the result in total_period. | 319 | * perf_record_sample.period and stash the result in total_period. |
407 | */ | 320 | */ |
408 | struct events_stats { | 321 | struct events_stats { |
409 | u64 total_period; | 322 | u64 total_period; |
@@ -637,16 +550,18 @@ struct compressed_event { | |||
637 | 550 | ||
638 | union perf_event { | 551 | union perf_event { |
639 | struct perf_event_header header; | 552 | struct perf_event_header header; |
640 | struct mmap_event mmap; | 553 | struct perf_record_mmap mmap; |
641 | struct mmap2_event mmap2; | 554 | struct perf_record_mmap2 mmap2; |
642 | struct comm_event comm; | 555 | struct perf_record_comm comm; |
643 | struct namespaces_event namespaces; | 556 | struct perf_record_namespaces namespaces; |
644 | struct fork_event fork; | 557 | struct perf_record_fork fork; |
645 | struct lost_event lost; | 558 | struct perf_record_lost lost; |
646 | struct lost_samples_event lost_samples; | 559 | struct perf_record_lost_samples lost_samples; |
647 | struct read_event read; | 560 | struct perf_record_read read; |
648 | struct throttle_event throttle; | 561 | struct perf_record_throttle throttle; |
649 | struct sample_event sample; | 562 | struct perf_record_sample sample; |
563 | struct perf_record_bpf_event bpf; | ||
564 | struct perf_record_ksymbol ksymbol; | ||
650 | struct attr_event attr; | 565 | struct attr_event attr; |
651 | struct event_update_event event_update; | 566 | struct event_update_event event_update; |
652 | struct event_type_event event_type; | 567 | struct event_type_event event_type; |
@@ -666,8 +581,6 @@ union perf_event { | |||
666 | struct stat_round_event stat_round; | 581 | struct stat_round_event stat_round; |
667 | struct time_conv_event time_conv; | 582 | struct time_conv_event time_conv; |
668 | struct feature_event feat; | 583 | struct feature_event feat; |
669 | struct ksymbol_event ksymbol_event; | ||
670 | struct bpf_event bpf_event; | ||
671 | struct compressed_event pack; | 584 | struct compressed_event pack; |
672 | }; | 585 | }; |
673 | 586 | ||
@@ -770,10 +683,10 @@ int perf_event__process_ksymbol(struct perf_tool *tool, | |||
770 | union perf_event *event, | 683 | union perf_event *event, |
771 | struct perf_sample *sample, | 684 | struct perf_sample *sample, |
772 | struct machine *machine); | 685 | struct machine *machine); |
773 | int perf_event__process_bpf_event(struct perf_tool *tool, | 686 | int perf_event__process_bpf(struct perf_tool *tool, |
774 | union perf_event *event, | 687 | union perf_event *event, |
775 | struct perf_sample *sample, | 688 | struct perf_sample *sample, |
776 | struct machine *machine); | 689 | struct machine *machine); |
777 | int perf_tool__process_synth_event(struct perf_tool *tool, | 690 | int perf_tool__process_synth_event(struct perf_tool *tool, |
778 | union perf_event *event, | 691 | union perf_event *event, |
779 | struct machine *machine, | 692 | struct machine *machine, |
@@ -838,7 +751,7 @@ size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp); | |||
838 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); | 751 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); |
839 | size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); | 752 | size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); |
840 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); | 753 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); |
841 | size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp); | 754 | size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp); |
842 | size_t perf_event__fprintf(union perf_event *event, FILE *fp); | 755 | size_t perf_event__fprintf(union perf_event *event, FILE *fp); |
843 | 756 | ||
844 | int kallsyms__get_function_start(const char *kallsyms_filename, | 757 | int kallsyms__get_function_start(const char *kallsyms_filename, |