diff options
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 1fa97dd21200..ab3a2b0e8f06 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2070,7 +2070,8 @@ out_delete_evlist: | |||
2070 | return -ENOMEM; | 2070 | return -ENOMEM; |
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, | 2073 | int perf_event__synthesize_attr(struct perf_event_ops *ops, |
2074 | struct perf_event_attr *attr, u16 ids, u64 *id, | ||
2074 | perf_event__handler_t process, | 2075 | perf_event__handler_t process, |
2075 | struct perf_session *session) | 2076 | struct perf_session *session) |
2076 | { | 2077 | { |
@@ -2094,21 +2095,22 @@ int perf_event__synthesize_attr(struct perf_event_attr *attr, u16 ids, u64 *id, | |||
2094 | ev->attr.header.type = PERF_RECORD_HEADER_ATTR; | 2095 | ev->attr.header.type = PERF_RECORD_HEADER_ATTR; |
2095 | ev->attr.header.size = size; | 2096 | ev->attr.header.size = size; |
2096 | 2097 | ||
2097 | err = process(ev, NULL, session); | 2098 | err = process(ops, ev, NULL, session); |
2098 | 2099 | ||
2099 | free(ev); | 2100 | free(ev); |
2100 | 2101 | ||
2101 | return err; | 2102 | return err; |
2102 | } | 2103 | } |
2103 | 2104 | ||
2104 | int perf_session__synthesize_attrs(struct perf_session *session, | 2105 | int perf_event__synthesize_attrs(struct perf_event_ops *ops, |
2106 | struct perf_session *session, | ||
2105 | perf_event__handler_t process) | 2107 | perf_event__handler_t process) |
2106 | { | 2108 | { |
2107 | struct perf_evsel *attr; | 2109 | struct perf_evsel *attr; |
2108 | int err = 0; | 2110 | int err = 0; |
2109 | 2111 | ||
2110 | list_for_each_entry(attr, &session->evlist->entries, node) { | 2112 | list_for_each_entry(attr, &session->evlist->entries, node) { |
2111 | err = perf_event__synthesize_attr(&attr->attr, attr->ids, | 2113 | err = perf_event__synthesize_attr(ops, &attr->attr, attr->ids, |
2112 | attr->id, process, session); | 2114 | attr->id, process, session); |
2113 | if (err) { | 2115 | if (err) { |
2114 | pr_debug("failed to create perf header attribute\n"); | 2116 | pr_debug("failed to create perf header attribute\n"); |
@@ -2156,7 +2158,8 @@ int perf_event__process_attr(union perf_event *event, | |||
2156 | return 0; | 2158 | return 0; |
2157 | } | 2159 | } |
2158 | 2160 | ||
2159 | int perf_event__synthesize_event_type(u64 event_id, char *name, | 2161 | int perf_event__synthesize_event_type(struct perf_event_ops *ops, |
2162 | u64 event_id, char *name, | ||
2160 | perf_event__handler_t process, | 2163 | perf_event__handler_t process, |
2161 | struct perf_session *session) | 2164 | struct perf_session *session) |
2162 | { | 2165 | { |
@@ -2176,12 +2179,13 @@ int perf_event__synthesize_event_type(u64 event_id, char *name, | |||
2176 | ev.event_type.header.size = sizeof(ev.event_type) - | 2179 | ev.event_type.header.size = sizeof(ev.event_type) - |
2177 | (sizeof(ev.event_type.event_type.name) - size); | 2180 | (sizeof(ev.event_type.event_type.name) - size); |
2178 | 2181 | ||
2179 | err = process(&ev, NULL, session); | 2182 | err = process(ops, &ev, NULL, session); |
2180 | 2183 | ||
2181 | return err; | 2184 | return err; |
2182 | } | 2185 | } |
2183 | 2186 | ||
2184 | int perf_event__synthesize_event_types(perf_event__handler_t process, | 2187 | int perf_event__synthesize_event_types(struct perf_event_ops *ops, |
2188 | perf_event__handler_t process, | ||
2185 | struct perf_session *session) | 2189 | struct perf_session *session) |
2186 | { | 2190 | { |
2187 | struct perf_trace_event_type *type; | 2191 | struct perf_trace_event_type *type; |
@@ -2190,7 +2194,7 @@ int perf_event__synthesize_event_types(perf_event__handler_t process, | |||
2190 | for (i = 0; i < event_count; i++) { | 2194 | for (i = 0; i < event_count; i++) { |
2191 | type = &events[i]; | 2195 | type = &events[i]; |
2192 | 2196 | ||
2193 | err = perf_event__synthesize_event_type(type->event_id, | 2197 | err = perf_event__synthesize_event_type(ops, type->event_id, |
2194 | type->name, process, | 2198 | type->name, process, |
2195 | session); | 2199 | session); |
2196 | if (err) { | 2200 | if (err) { |
@@ -2202,7 +2206,8 @@ int perf_event__synthesize_event_types(perf_event__handler_t process, | |||
2202 | return err; | 2206 | return err; |
2203 | } | 2207 | } |
2204 | 2208 | ||
2205 | int perf_event__process_event_type(union perf_event *event, | 2209 | int perf_event__process_event_type(struct perf_event_ops *ops __unused, |
2210 | union perf_event *event, | ||
2206 | struct perf_session *session __unused) | 2211 | struct perf_session *session __unused) |
2207 | { | 2212 | { |
2208 | if (perf_header__push_event(event->event_type.event_type.event_id, | 2213 | if (perf_header__push_event(event->event_type.event_type.event_id, |
@@ -2212,7 +2217,8 @@ int perf_event__process_event_type(union perf_event *event, | |||
2212 | return 0; | 2217 | return 0; |
2213 | } | 2218 | } |
2214 | 2219 | ||
2215 | int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist, | 2220 | int perf_event__synthesize_tracing_data(struct perf_event_ops *ops, int fd, |
2221 | struct perf_evlist *evlist, | ||
2216 | perf_event__handler_t process, | 2222 | perf_event__handler_t process, |
2217 | struct perf_session *session __unused) | 2223 | struct perf_session *session __unused) |
2218 | { | 2224 | { |
@@ -2245,7 +2251,7 @@ int perf_event__synthesize_tracing_data(int fd, struct perf_evlist *evlist, | |||
2245 | ev.tracing_data.header.size = sizeof(ev.tracing_data); | 2251 | ev.tracing_data.header.size = sizeof(ev.tracing_data); |
2246 | ev.tracing_data.size = aligned_size; | 2252 | ev.tracing_data.size = aligned_size; |
2247 | 2253 | ||
2248 | process(&ev, NULL, session); | 2254 | process(ops, &ev, NULL, session); |
2249 | 2255 | ||
2250 | /* | 2256 | /* |
2251 | * The put function will copy all the tracing data | 2257 | * The put function will copy all the tracing data |
@@ -2287,7 +2293,8 @@ int perf_event__process_tracing_data(union perf_event *event, | |||
2287 | return size_read + padding; | 2293 | return size_read + padding; |
2288 | } | 2294 | } |
2289 | 2295 | ||
2290 | int perf_event__synthesize_build_id(struct dso *pos, u16 misc, | 2296 | int perf_event__synthesize_build_id(struct perf_event_ops *ops, |
2297 | struct dso *pos, u16 misc, | ||
2291 | perf_event__handler_t process, | 2298 | perf_event__handler_t process, |
2292 | struct machine *machine, | 2299 | struct machine *machine, |
2293 | struct perf_session *session) | 2300 | struct perf_session *session) |
@@ -2310,12 +2317,13 @@ int perf_event__synthesize_build_id(struct dso *pos, u16 misc, | |||
2310 | ev.build_id.header.size = sizeof(ev.build_id) + len; | 2317 | ev.build_id.header.size = sizeof(ev.build_id) + len; |
2311 | memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len); | 2318 | memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len); |
2312 | 2319 | ||
2313 | err = process(&ev, NULL, session); | 2320 | err = process(ops, &ev, NULL, session); |
2314 | 2321 | ||
2315 | return err; | 2322 | return err; |
2316 | } | 2323 | } |
2317 | 2324 | ||
2318 | int perf_event__process_build_id(union perf_event *event, | 2325 | int perf_event__process_build_id(struct perf_event_ops *ops __used, |
2326 | union perf_event *event, | ||
2319 | struct perf_session *session) | 2327 | struct perf_session *session) |
2320 | { | 2328 | { |
2321 | __event_process_build_id(&event->build_id, | 2329 | __event_process_build_id(&event->build_id, |