hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/tools/perf/util/header.h
....@@ -5,10 +5,10 @@
55 #include <linux/stddef.h>
66 #include <linux/perf_event.h>
77 #include <sys/types.h>
8
+#include <stdio.h> // FILE
89 #include <stdbool.h>
910 #include <linux/bitmap.h>
1011 #include <linux/types.h>
11
-#include "event.h"
1212 #include "env.h"
1313 #include "pmu.h"
1414
....@@ -38,6 +38,13 @@
3838 HEADER_CACHE,
3939 HEADER_SAMPLE_TIME,
4040 HEADER_MEM_TOPOLOGY,
41
+ HEADER_CLOCKID,
42
+ HEADER_DIR_FORMAT,
43
+ HEADER_BPF_PROG_INFO,
44
+ HEADER_BPF_BTF,
45
+ HEADER_COMPRESSED,
46
+ HEADER_CPU_PMU_CAPS,
47
+ HEADER_CLOCK_DATA,
4148 HEADER_LAST_FEATURE,
4249 HEADER_FEAT_BITS = 256,
4350 };
....@@ -83,12 +90,32 @@
8390 struct perf_env env;
8491 };
8592
86
-struct perf_evlist;
93
+struct feat_fd {
94
+ struct perf_header *ph;
95
+ int fd;
96
+ void *buf; /* Either buf != NULL or fd >= 0 */
97
+ ssize_t offset;
98
+ size_t size;
99
+ struct evsel *events;
100
+};
101
+
102
+struct perf_header_feature_ops {
103
+ int (*write)(struct feat_fd *ff, struct evlist *evlist);
104
+ void (*print)(struct feat_fd *ff, FILE *fp);
105
+ int (*process)(struct feat_fd *ff, void *data);
106
+ const char *name;
107
+ bool full_only;
108
+ bool synthesize;
109
+};
110
+
111
+struct evlist;
87112 struct perf_session;
113
+struct perf_tool;
114
+union perf_event;
88115
89116 int perf_session__read_header(struct perf_session *session);
90117 int perf_session__write_header(struct perf_session *session,
91
- struct perf_evlist *evlist,
118
+ struct evlist *evlist,
92119 int fd, bool at_exit);
93120 int perf_header__write_pipe(int fd);
94121
....@@ -106,59 +133,18 @@
106133
107134 int perf_header__fprintf_info(struct perf_session *s, FILE *fp, bool full);
108135
109
-int perf_event__synthesize_features(struct perf_tool *tool,
110
- struct perf_session *session,
111
- struct perf_evlist *evlist,
112
- perf_event__handler_t process);
113
-
114
-int perf_event__synthesize_extra_attr(struct perf_tool *tool,
115
- struct perf_evlist *evsel_list,
116
- perf_event__handler_t process,
117
- bool is_pipe);
118
-
119
-int perf_event__process_feature(struct perf_tool *tool,
120
- union perf_event *event,
121
- struct perf_session *session);
122
-
123
-int perf_event__synthesize_attr(struct perf_tool *tool,
124
- struct perf_event_attr *attr, u32 ids, u64 *id,
125
- perf_event__handler_t process);
126
-int perf_event__synthesize_attrs(struct perf_tool *tool,
127
- struct perf_session *session,
128
- perf_event__handler_t process);
129
-int perf_event__synthesize_event_update_unit(struct perf_tool *tool,
130
- struct perf_evsel *evsel,
131
- perf_event__handler_t process);
132
-int perf_event__synthesize_event_update_scale(struct perf_tool *tool,
133
- struct perf_evsel *evsel,
134
- perf_event__handler_t process);
135
-int perf_event__synthesize_event_update_name(struct perf_tool *tool,
136
- struct perf_evsel *evsel,
137
- perf_event__handler_t process);
138
-int perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
139
- struct perf_evsel *evsel,
140
- perf_event__handler_t process);
136
+int perf_event__process_feature(struct perf_session *session,
137
+ union perf_event *event);
141138 int perf_event__process_attr(struct perf_tool *tool, union perf_event *event,
142
- struct perf_evlist **pevlist);
139
+ struct evlist **pevlist);
143140 int perf_event__process_event_update(struct perf_tool *tool,
144141 union perf_event *event,
145
- struct perf_evlist **pevlist);
142
+ struct evlist **pevlist);
146143 size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp);
147
-
148
-int perf_event__synthesize_tracing_data(struct perf_tool *tool,
149
- int fd, struct perf_evlist *evlist,
150
- perf_event__handler_t process);
151
-int perf_event__process_tracing_data(struct perf_tool *tool,
152
- union perf_event *event,
153
- struct perf_session *session);
154
-
155
-int perf_event__synthesize_build_id(struct perf_tool *tool,
156
- struct dso *pos, u16 misc,
157
- perf_event__handler_t process,
158
- struct machine *machine);
159
-int perf_event__process_build_id(struct perf_tool *tool,
160
- union perf_event *event,
161
- struct perf_session *session);
144
+int perf_event__process_tracing_data(struct perf_session *session,
145
+ union perf_event *event);
146
+int perf_event__process_build_id(struct perf_session *session,
147
+ union perf_event *event);
162148 bool is_perf_magic(u64 magic);
163149
164150 #define NAME_ALIGN 64