diff options
-rw-r--r-- | tools/perf/builtin-annotate.c | 34 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 18 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 53 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 20 | ||||
-rw-r--r-- | tools/perf/util/event.h | 54 | ||||
-rw-r--r-- | tools/perf/util/util.h | 2 |
6 files changed, 56 insertions, 125 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 1a792990031a..fee663adeea2 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -44,40 +44,6 @@ static int print_line; | |||
44 | static unsigned long page_size; | 44 | static unsigned long page_size; |
45 | static unsigned long mmap_window = 32; | 45 | static unsigned long mmap_window = 32; |
46 | 46 | ||
47 | struct ip_event { | ||
48 | struct perf_event_header header; | ||
49 | u64 ip; | ||
50 | u32 pid, tid; | ||
51 | }; | ||
52 | |||
53 | struct mmap_event { | ||
54 | struct perf_event_header header; | ||
55 | u32 pid, tid; | ||
56 | u64 start; | ||
57 | u64 len; | ||
58 | u64 pgoff; | ||
59 | char filename[PATH_MAX]; | ||
60 | }; | ||
61 | |||
62 | struct comm_event { | ||
63 | struct perf_event_header header; | ||
64 | u32 pid, tid; | ||
65 | char comm[16]; | ||
66 | }; | ||
67 | |||
68 | struct fork_event { | ||
69 | struct perf_event_header header; | ||
70 | u32 pid, ppid; | ||
71 | }; | ||
72 | |||
73 | typedef union event_union { | ||
74 | struct perf_event_header header; | ||
75 | struct ip_event ip; | ||
76 | struct mmap_event mmap; | ||
77 | struct comm_event comm; | ||
78 | struct fork_event fork; | ||
79 | } event_t; | ||
80 | |||
81 | 47 | ||
82 | struct sym_ext { | 48 | struct sym_ext { |
83 | struct rb_node node; | 49 | struct rb_node node; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index afae3873b47c..718b8f7b6aac 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -59,24 +59,6 @@ static int file_new = 1; | |||
59 | 59 | ||
60 | struct perf_header *header; | 60 | struct perf_header *header; |
61 | 61 | ||
62 | struct mmap_event { | ||
63 | struct perf_event_header header; | ||
64 | u32 pid; | ||
65 | u32 tid; | ||
66 | u64 start; | ||
67 | u64 len; | ||
68 | u64 pgoff; | ||
69 | char filename[PATH_MAX]; | ||
70 | }; | ||
71 | |||
72 | struct comm_event { | ||
73 | struct perf_event_header header; | ||
74 | u32 pid; | ||
75 | u32 tid; | ||
76 | char comm[16]; | ||
77 | }; | ||
78 | |||
79 | |||
80 | struct mmap_data { | 62 | struct mmap_data { |
81 | int counter; | 63 | int counter; |
82 | void *base; | 64 | void *base; |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 827eab2edf4b..1efefcc2ffdf 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -75,59 +75,6 @@ struct callchain_param callchain_param = { | |||
75 | 75 | ||
76 | static u64 sample_type; | 76 | static u64 sample_type; |
77 | 77 | ||
78 | struct ip_event { | ||
79 | struct perf_event_header header; | ||
80 | u64 ip; | ||
81 | u32 pid, tid; | ||
82 | unsigned char __more_data[]; | ||
83 | }; | ||
84 | |||
85 | struct mmap_event { | ||
86 | struct perf_event_header header; | ||
87 | u32 pid, tid; | ||
88 | u64 start; | ||
89 | u64 len; | ||
90 | u64 pgoff; | ||
91 | char filename[PATH_MAX]; | ||
92 | }; | ||
93 | |||
94 | struct comm_event { | ||
95 | struct perf_event_header header; | ||
96 | u32 pid, tid; | ||
97 | char comm[16]; | ||
98 | }; | ||
99 | |||
100 | struct fork_event { | ||
101 | struct perf_event_header header; | ||
102 | u32 pid, ppid; | ||
103 | u32 tid, ptid; | ||
104 | }; | ||
105 | |||
106 | struct lost_event { | ||
107 | struct perf_event_header header; | ||
108 | u64 id; | ||
109 | u64 lost; | ||
110 | }; | ||
111 | |||
112 | struct read_event { | ||
113 | struct perf_event_header header; | ||
114 | u32 pid,tid; | ||
115 | u64 value; | ||
116 | u64 time_enabled; | ||
117 | u64 time_running; | ||
118 | u64 id; | ||
119 | }; | ||
120 | |||
121 | typedef union event_union { | ||
122 | struct perf_event_header header; | ||
123 | struct ip_event ip; | ||
124 | struct mmap_event mmap; | ||
125 | struct comm_event comm; | ||
126 | struct fork_event fork; | ||
127 | struct lost_event lost; | ||
128 | struct read_event read; | ||
129 | } event_t; | ||
130 | |||
131 | static int repsep_fprintf(FILE *fp, const char *fmt, ...) | 78 | static int repsep_fprintf(FILE *fp, const char *fmt, ...) |
132 | { | 79 | { |
133 | int n; | 80 | int n; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 0aa567371bd3..9a6dbbff9a9f 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -933,26 +933,6 @@ static void mmap_read_counter(struct mmap_data *md) | |||
933 | last_read = this_read; | 933 | last_read = this_read; |
934 | 934 | ||
935 | for (; old != head;) { | 935 | for (; old != head;) { |
936 | struct ip_event { | ||
937 | struct perf_event_header header; | ||
938 | u64 ip; | ||
939 | u32 pid, target_pid; | ||
940 | }; | ||
941 | struct mmap_event { | ||
942 | struct perf_event_header header; | ||
943 | u32 pid, target_pid; | ||
944 | u64 start; | ||
945 | u64 len; | ||
946 | u64 pgoff; | ||
947 | char filename[PATH_MAX]; | ||
948 | }; | ||
949 | |||
950 | typedef union event_union { | ||
951 | struct perf_event_header header; | ||
952 | struct ip_event ip; | ||
953 | struct mmap_event mmap; | ||
954 | } event_t; | ||
955 | |||
956 | event_t *event = (event_t *)&data[old & md->mask]; | 936 | event_t *event = (event_t *)&data[old & md->mask]; |
957 | 937 | ||
958 | event_t event_copy; | 938 | event_t event_copy; |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h new file mode 100644 index 000000000000..91e2fe589f27 --- /dev/null +++ b/tools/perf/util/event.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #include "../perf.h" | ||
2 | |||
3 | struct ip_event { | ||
4 | struct perf_event_header header; | ||
5 | u64 ip; | ||
6 | u32 pid, tid; | ||
7 | unsigned char __more_data[]; | ||
8 | }; | ||
9 | |||
10 | struct mmap_event { | ||
11 | struct perf_event_header header; | ||
12 | u32 pid, tid; | ||
13 | u64 start; | ||
14 | u64 len; | ||
15 | u64 pgoff; | ||
16 | char filename[PATH_MAX]; | ||
17 | }; | ||
18 | |||
19 | struct comm_event { | ||
20 | struct perf_event_header header; | ||
21 | u32 pid, tid; | ||
22 | char comm[16]; | ||
23 | }; | ||
24 | |||
25 | struct fork_event { | ||
26 | struct perf_event_header header; | ||
27 | u32 pid, ppid; | ||
28 | u32 tid, ptid; | ||
29 | }; | ||
30 | |||
31 | struct lost_event { | ||
32 | struct perf_event_header header; | ||
33 | u64 id; | ||
34 | u64 lost; | ||
35 | }; | ||
36 | |||
37 | struct read_event { | ||
38 | struct perf_event_header header; | ||
39 | u32 pid,tid; | ||
40 | u64 value; | ||
41 | u64 time_enabled; | ||
42 | u64 time_running; | ||
43 | u64 id; | ||
44 | }; | ||
45 | |||
46 | typedef union event_union { | ||
47 | struct perf_event_header header; | ||
48 | struct ip_event ip; | ||
49 | struct mmap_event mmap; | ||
50 | struct comm_event comm; | ||
51 | struct fork_event fork; | ||
52 | struct lost_event lost; | ||
53 | struct read_event read; | ||
54 | } event_t; | ||
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 68fe157d72fb..be4b52cca2c3 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -83,6 +83,8 @@ | |||
83 | #include <inttypes.h> | 83 | #include <inttypes.h> |
84 | #include "../../../include/linux/magic.h" | 84 | #include "../../../include/linux/magic.h" |
85 | 85 | ||
86 | #include "event.h" | ||
87 | |||
86 | #ifndef NO_ICONV | 88 | #ifndef NO_ICONV |
87 | #include <iconv.h> | 89 | #include <iconv.h> |
88 | #endif | 90 | #endif |