Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Move event synthesizing routines to separate header

Those are the only routines using the perf_event__handler_t typedef and
are all related, so move to a separate header to reduce the header
dependency tree, lots of places were getting event.h and even stdio.h,
limits.h indirectly, so fix those as well.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-yvx9u1mf7baq6cu1abfhbqgs@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+154 -177
+1
tools/perf/arch/x86/util/archinsn.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "../../../../arch/x86/include/asm/insn.h" 3 3 #include "archinsn.h" 4 + #include "event.h" 4 5 #include "machine.h" 5 6 #include "thread.h" 6 7 #include "symbol.h"
+2
tools/perf/arch/x86/util/event.c
··· 3 3 #include <linux/string.h> 4 4 #include <linux/zalloc.h> 5 5 6 + #include "../../util/event.h" 7 + #include "../../util/synthetic-events.h" 6 8 #include "../../util/machine.h" 7 9 #include "../../util/tool.h" 8 10 #include "../../util/map.h"
+1
tools/perf/arch/x86/util/machine.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/types.h> 3 3 #include <linux/string.h> 4 + #include <limits.h> 4 5 #include <stdlib.h> 5 6 6 7 #include "../../util/util.h" // page_size
+2
tools/perf/arch/x86/util/tsc.c
··· 8 8 #include <linux/types.h> 9 9 #include <asm/barrier.h> 10 10 #include "../../../util/debug.h" 11 + #include "../../../util/event.h" 12 + #include "../../../util/synthetic-events.h" 11 13 #include "../../../util/tsc.h" 12 14 13 15 int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
+1
tools/perf/builtin-inject.c
··· 21 21 #include "util/auxtrace.h" 22 22 #include "util/jit.h" 23 23 #include "util/symbol.h" 24 + #include "util/synthetic-events.h" 24 25 #include "util/thread.h" 25 26 26 27 #include <subcmd/parse-options.h>
+1
tools/perf/builtin-kvm.c
··· 17 17 #include "util/debug.h" 18 18 #include "util/tool.h" 19 19 #include "util/stat.h" 20 + #include "util/synthetic-events.h" 20 21 #include "util/top.h" 21 22 #include "util/data.h" 22 23 #include "util/ordered-events.h"
+1
tools/perf/builtin-record.c
··· 38 38 #include "util/trigger.h" 39 39 #include "util/perf-hooks.h" 40 40 #include "util/cpu-set-sched.h" 41 + #include "util/synthetic-events.h" 41 42 #include "util/time-utils.h" 42 43 #include "util/units.h" 43 44 #include "util/bpf-event.h"
+1
tools/perf/builtin-stat.c
··· 61 61 #include "util/tool.h" 62 62 #include "util/string2.h" 63 63 #include "util/metricgroup.h" 64 + #include "util/synthetic-events.h" 64 65 #include "util/target.h" 65 66 #include "util/time-utils.h" 66 67 #include "util/top.h"
+1
tools/perf/builtin-top.c
··· 32 32 #include "util/map.h" 33 33 #include "util/session.h" 34 34 #include "util/symbol.h" 35 + #include "util/synthetic-events.h" 35 36 #include "util/top.h" 36 37 #include "util/util.h" 37 38 #include <linux/rbtree.h>
+1
tools/perf/builtin-trace.c
··· 28 28 #include "util/dso.h" 29 29 #include "util/env.h" 30 30 #include "util/event.h" 31 + #include "util/synthetic-events.h" 31 32 #include "util/evlist.h" 32 33 #include "util/evswitch.h" 33 34 #include <subcmd/pager.h>
+1
tools/perf/tests/code-reading.c
··· 24 24 #include "symbol.h" 25 25 #include "event.h" 26 26 #include "record.h" 27 + #include "util/synthetic-events.h" 27 28 #include "thread.h" 28 29 29 30 #include "tests.h"
+1
tools/perf/tests/cpumap.c
··· 3 3 #include <stdio.h> 4 4 #include "cpumap.h" 5 5 #include "event.h" 6 + #include "util/synthetic-events.h" 6 7 #include <string.h> 7 8 #include <linux/bitops.h> 8 9 #include <perf/cpumap.h>
+1
tools/perf/tests/dwarf-unwind.c
··· 15 15 #include "symbol.h" 16 16 #include "thread.h" 17 17 #include "callchain.h" 18 + #include "util/synthetic-events.h" 18 19 19 20 #if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__) 20 21 #include "arch-tests.h"
+1
tools/perf/tests/event_update.c
··· 7 7 #include "evsel.h" 8 8 #include "header.h" 9 9 #include "machine.h" 10 + #include "util/synthetic-events.h" 10 11 #include "tool.h" 11 12 #include "tests.h" 12 13 #include "debug.h"
+2
tools/perf/tests/hists_common.c
··· 2 2 #include <inttypes.h> 3 3 #include "util/debug.h" 4 4 #include "util/dso.h" 5 + #include "util/event.h" // struct perf_sample 5 6 #include "util/map.h" 6 7 #include "util/symbol.h" 7 8 #include "util/sort.h" ··· 11 10 #include "util/thread.h" 12 11 #include "tests/hists_common.h" 13 12 #include <linux/kernel.h> 13 + #include <linux/perf_event.h> 14 14 15 15 static struct { 16 16 u32 pid;
+2
tools/perf/tests/mmap-thread-lookup.c
··· 8 8 #include <stdlib.h> 9 9 #include <stdio.h> 10 10 #include "debug.h" 11 + #include "event.h" 11 12 #include "tests.h" 12 13 #include "machine.h" 13 14 #include "thread_map.h" 14 15 #include "map.h" 15 16 #include "symbol.h" 17 + #include "util/synthetic-events.h" 16 18 #include "thread.h" 17 19 #include "util.h" // page_size 18 20
+1
tools/perf/tests/sample-parsing.c
··· 12 12 #include "event.h" 13 13 #include "evsel.h" 14 14 #include "debug.h" 15 + #include "util/synthetic-events.h" 15 16 16 17 #include "tests.h" 17 18
+1
tools/perf/tests/stat.c
··· 5 5 #include "stat.h" 6 6 #include "counts.h" 7 7 #include "debug.h" 8 + #include "util/synthetic-events.h" 8 9 9 10 static bool has_term(struct perf_record_stat_config *config, 10 11 u64 tag, u64 val)
+1
tools/perf/tests/thread-map.c
··· 8 8 #include "thread_map.h" 9 9 #include "debug.h" 10 10 #include "event.h" 11 + #include "util/synthetic-events.h" 11 12 #include <linux/zalloc.h> 12 13 #include <perf/event.h> 13 14
+1
tools/perf/ui/stdio/hist.c
··· 5 5 6 6 #include "../../util/callchain.h" 7 7 #include "../../util/debug.h" 8 + #include "../../util/event.h" 8 9 #include "../../util/hist.h" 9 10 #include "../../util/map.h" 10 11 #include "../../util/map_groups.h"
+1
tools/perf/util/auxtrace.c
··· 32 32 #include "pmu.h" 33 33 #include "evsel.h" 34 34 #include "symbol.h" 35 + #include "util/synthetic-events.h" 35 36 #include "thread_map.h" 36 37 #include "asm/bug.h" 37 38 #include "auxtrace.h"
+2 -15
tools/perf/util/auxtrace.h
··· 11 11 #include <errno.h> 12 12 #include <stdbool.h> 13 13 #include <stddef.h> 14 + #include <stdio.h> // FILE 14 15 #include <linux/list.h> 15 16 #include <linux/perf_event.h> 16 17 #include <linux/types.h> 17 18 #include <asm/bitsperlong.h> 18 19 #include <asm/barrier.h> 19 - 20 - #include "event.h" 21 20 22 21 union perf_event; 23 22 struct perf_session; ··· 26 27 struct perf_sample; 27 28 struct option; 28 29 struct record_opts; 30 + struct perf_record_auxtrace_error; 29 31 struct perf_record_auxtrace_info; 30 32 struct events_stats; 31 33 ··· 525 525 int code, int cpu, pid_t pid, pid_t tid, u64 ip, 526 526 const char *msg, u64 timestamp); 527 527 528 - int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, 529 - struct perf_tool *tool, 530 - struct perf_session *session, 531 - perf_event__handler_t process); 532 528 int perf_event__process_auxtrace_info(struct perf_session *session, 533 529 union perf_event *event); 534 530 s64 perf_event__process_auxtrace(struct perf_session *session, ··· 599 603 static inline 600 604 void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused) 601 605 { 602 - } 603 - 604 - static inline int 605 - perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused, 606 - struct perf_tool *tool __maybe_unused, 607 - struct perf_session *session __maybe_unused, 608 - perf_event__handler_t process __maybe_unused) 609 - { 610 - return -EINVAL; 611 606 } 612 607 613 608 static inline
+1
tools/perf/util/bpf-event.c
··· 16 16 #include "map.h" 17 17 #include "evlist.h" 18 18 #include "record.h" 19 + #include "util/synthetic-events.h" 19 20 20 21 #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) 21 22
+1 -14
tools/perf/util/bpf-event.h
··· 6 6 #include <linux/rbtree.h> 7 7 #include <pthread.h> 8 8 #include <api/fd/array.h> 9 - #include "event.h" 10 9 #include <stdio.h> 11 10 11 + struct bpf_prog_info; 12 12 struct machine; 13 13 union perf_event; 14 14 struct perf_env; ··· 33 33 #ifdef HAVE_LIBBPF_SUPPORT 34 34 int machine__process_bpf(struct machine *machine, union perf_event *event, 35 35 struct perf_sample *sample); 36 - 37 - int perf_event__synthesize_bpf_events(struct perf_session *session, 38 - perf_event__handler_t process, 39 - struct machine *machine, 40 - struct record_opts *opts); 41 36 int bpf_event__add_sb_event(struct evlist **evlist, 42 37 struct perf_env *env); 43 38 void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, ··· 42 47 static inline int machine__process_bpf(struct machine *machine __maybe_unused, 43 48 union perf_event *event __maybe_unused, 44 49 struct perf_sample *sample __maybe_unused) 45 - { 46 - return 0; 47 - } 48 - 49 - static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused, 50 - perf_event__handler_t process __maybe_unused, 51 - struct machine *machine __maybe_unused, 52 - struct record_opts *opts __maybe_unused) 53 50 { 54 51 return 0; 55 52 }
+1
tools/perf/util/callchain.c
··· 23 23 24 24 #include "debug.h" 25 25 #include "dso.h" 26 + #include "event.h" 26 27 #include "hist.h" 27 28 #include "sort.h" 28 29 #include "machine.h"
+1
tools/perf/util/event.c
··· 32 32 #include "stat.h" 33 33 #include "session.h" 34 34 #include "bpf-event.h" 35 + #include "synthetic-events.h" 35 36 #include "tool.h" 36 37 #include "../perf.h" 37 38
+2 -116
tools/perf/util/event.h
··· 279 279 280 280 void perf_event__print_totals(void); 281 281 282 - struct evlist; 283 - struct evsel; 284 - struct perf_session; 285 - struct perf_tool; 286 - struct perf_thread_map; 287 282 struct perf_cpu_map; 283 + struct perf_record_stat_config; 288 284 struct perf_stat_config; 289 - struct perf_counts_values; 285 + struct perf_tool; 290 286 291 - typedef int (*perf_event__handler_t)(struct perf_tool *tool, 292 - union perf_event *event, 293 - struct perf_sample *sample, 294 - struct machine *machine); 295 - 296 - int perf_event__synthesize_stat_events(struct perf_stat_config *config, 297 - struct perf_tool *tool, 298 - struct evlist *evlist, 299 - perf_event__handler_t process, 300 - bool attrs); 301 - int perf_event__synthesize_attr(struct perf_tool *tool, 302 - struct perf_event_attr *attr, u32 ids, u64 *id, 303 - perf_event__handler_t process); 304 - int perf_event__synthesize_attrs(struct perf_tool *tool, 305 - struct evlist *evlist, 306 - perf_event__handler_t process); 307 - int perf_event__synthesize_build_id(struct perf_tool *tool, 308 - struct dso *pos, u16 misc, 309 - perf_event__handler_t process, 310 - struct machine *machine); 311 - int perf_event__synthesize_extra_attr(struct perf_tool *tool, 312 - struct evlist *evsel_list, 313 - perf_event__handler_t process, 314 - bool is_pipe); 315 - int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, 316 - struct evsel *evsel, 317 - perf_event__handler_t process); 318 - int perf_event__synthesize_event_update_name(struct perf_tool *tool, 319 - struct evsel *evsel, 320 - perf_event__handler_t process); 321 - int perf_event__synthesize_event_update_scale(struct perf_tool *tool, 322 - struct evsel *evsel, 323 - perf_event__handler_t process); 324 - int perf_event__synthesize_event_update_unit(struct perf_tool *tool, 325 - struct evsel *evsel, 326 - perf_event__handler_t process); 327 - int perf_event__synthesize_features(struct perf_tool *tool, 328 - struct perf_session *session, 329 - struct evlist *evlist, 330 - perf_event__handler_t process); 331 - int perf_event__synthesize_tracing_data(struct perf_tool *tool, 332 - int fd, struct evlist *evlist, 333 - perf_event__handler_t process); 334 - int perf_event__synthesize_thread_map(struct perf_tool *tool, 335 - struct perf_thread_map *threads, 336 - perf_event__handler_t process, 337 - struct machine *machine, bool mmap_data); 338 - int perf_event__synthesize_thread_map2(struct perf_tool *tool, 339 - struct perf_thread_map *threads, 340 - perf_event__handler_t process, 341 - struct machine *machine); 342 - int perf_event__synthesize_cpu_map(struct perf_tool *tool, 343 - struct perf_cpu_map *cpus, 344 - perf_event__handler_t process, 345 - struct machine *machine); 346 - int perf_event__synthesize_threads(struct perf_tool *tool, 347 - perf_event__handler_t process, 348 - struct machine *machine, bool mmap_data, 349 - unsigned int nr_threads_synthesize); 350 - int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, 351 - perf_event__handler_t process, 352 - struct machine *machine); 353 - int perf_event__synthesize_stat_config(struct perf_tool *tool, 354 - struct perf_stat_config *config, 355 - perf_event__handler_t process, 356 - struct machine *machine); 357 287 void perf_event__read_stat_config(struct perf_stat_config *config, 358 288 struct perf_record_stat_config *event); 359 - int perf_event__synthesize_stat(struct perf_tool *tool, 360 - u32 cpu, u32 thread, u64 id, 361 - struct perf_counts_values *count, 362 - perf_event__handler_t process, 363 - struct machine *machine); 364 - int perf_event__synthesize_stat_round(struct perf_tool *tool, 365 - u64 time, u64 type, 366 - perf_event__handler_t process, 367 - struct machine *machine); 368 - int perf_event__synthesize_modules(struct perf_tool *tool, 369 - perf_event__handler_t process, 370 - struct machine *machine); 371 289 372 290 int perf_event__process_comm(struct perf_tool *tool, 373 291 union perf_event *event, ··· 339 421 union perf_event *event, 340 422 struct perf_sample *sample, 341 423 struct machine *machine); 342 - int perf_tool__process_synth_event(struct perf_tool *tool, 343 - union perf_event *event, 344 - struct machine *machine, 345 - perf_event__handler_t process); 346 424 int perf_event__process(struct perf_tool *tool, 347 425 union perf_event *event, 348 426 struct perf_sample *sample, ··· 359 445 struct perf_sample *sample); 360 446 361 447 const char *perf_event__name(unsigned int id); 362 - 363 - size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, 364 - u64 read_format); 365 - int perf_event__synthesize_sample(union perf_event *event, u64 type, 366 - u64 read_format, 367 - const struct perf_sample *sample); 368 - 369 - pid_t perf_event__synthesize_comm(struct perf_tool *tool, 370 - union perf_event *event, pid_t pid, 371 - perf_event__handler_t process, 372 - struct machine *machine); 373 - 374 - int perf_event__synthesize_namespaces(struct perf_tool *tool, 375 - union perf_event *event, 376 - pid_t pid, pid_t tgid, 377 - perf_event__handler_t process, 378 - struct machine *machine); 379 - 380 - int perf_event__synthesize_mmap_events(struct perf_tool *tool, 381 - union perf_event *event, 382 - pid_t pid, pid_t tgid, 383 - perf_event__handler_t process, 384 - struct machine *machine, 385 - bool mmap_data); 386 - 387 - int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, 388 - perf_event__handler_t process, 389 - struct machine *machine); 390 448 391 449 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); 392 450 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
+1
tools/perf/util/evsel.c
··· 40 40 #include "trace-event.h" 41 41 #include "stat.h" 42 42 #include "string2.h" 43 + #include "util/synthetic-events.h" 43 44 #include "memswap.h" 44 45 #include "util.h" 45 46 #include "../perf-sys.h"
+1
tools/perf/util/header.c
··· 45 45 #include "util.h" // page_size, perf_exe() 46 46 #include "cputopo.h" 47 47 #include "bpf-event.h" 48 + #include "util/synthetic-events.h" 48 49 49 50 #include <linux/ctype.h> 50 51 #include <internal/lib.h>
+1
tools/perf/util/intel-bts.c
··· 28 28 #include "auxtrace.h" 29 29 #include "intel-pt-decoder/intel-pt-insn-decoder.h" 30 30 #include "intel-bts.h" 31 + #include "util/synthetic-events.h" 31 32 32 33 #define MAX_TIMESTAMP (~0ULL) 33 34
+1
tools/perf/util/intel-pt.c
··· 33 33 #include "tsc.h" 34 34 #include "intel-pt.h" 35 35 #include "config.h" 36 + #include "util/synthetic-events.h" 36 37 #include "time-utils.h" 37 38 38 39 #include "../arch/x86/include/uapi/asm/perf_regs.h"
+10
tools/perf/util/machine.c
··· 20 20 #include "symbol.h" 21 21 #include "sort.h" 22 22 #include "strlist.h" 23 + #include "util/synthetic-events.h" 23 24 #include "target.h" 24 25 #include "thread.h" 25 26 #include "util.h" ··· 2623 2622 nr_threads_synthesize); 2624 2623 /* command specified */ 2625 2624 return 0; 2625 + } 2626 + 2627 + int machine__synthesize_threads(struct machine *machine, struct target *target, 2628 + struct perf_thread_map *threads, bool data_mmap, 2629 + unsigned int nr_threads_synthesize) 2630 + { 2631 + return __machine__synthesize_threads(machine, NULL, target, threads, 2632 + perf_event__process, data_mmap, 2633 + nr_threads_synthesize); 2626 2634 } 2627 2635 2628 2636 pid_t machine__get_current_tid(struct machine *machine, int cpu)
-15
tools/perf/util/machine.h
··· 6 6 #include <linux/rbtree.h> 7 7 #include "map_groups.h" 8 8 #include "dsos.h" 9 - #include "event.h" 10 9 #include "rwsem.h" 11 10 12 11 struct addr_location; ··· 250 251 int machines__for_each_thread(struct machines *machines, 251 252 int (*fn)(struct thread *thread, void *p), 252 253 void *priv); 253 - 254 - int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, 255 - struct target *target, struct perf_thread_map *threads, 256 - perf_event__handler_t process, bool data_mmap, 257 - unsigned int nr_threads_synthesize); 258 - static inline 259 - int machine__synthesize_threads(struct machine *machine, struct target *target, 260 - struct perf_thread_map *threads, bool data_mmap, 261 - unsigned int nr_threads_synthesize) 262 - { 263 - return __machine__synthesize_threads(machine, NULL, target, threads, 264 - perf_event__process, data_mmap, 265 - nr_threads_synthesize); 266 - } 267 254 268 255 pid_t machine__get_current_tid(struct machine *machine, int cpu); 269 256 int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
+1
tools/perf/util/session.c
··· 29 29 #include "thread-stack.h" 30 30 #include "sample-raw.h" 31 31 #include "stat.h" 32 + #include "util/synthetic-events.h" 32 33 #include "util.h" 33 34 #include "ui/progress.h" 34 35 #include "../perf.h"
-5
tools/perf/util/session.h
··· 138 138 int perf_event__process_id_index(struct perf_session *session, 139 139 union perf_event *event); 140 140 141 - int perf_event__synthesize_id_index(struct perf_tool *tool, 142 - perf_event__handler_t process, 143 - struct evlist *evlist, 144 - struct machine *machine); 145 - 146 141 #endif /* __PERF_SESSION_H */
+1
tools/perf/util/stat.c
··· 12 12 #include "target.h" 13 13 #include "evlist.h" 14 14 #include "evsel.h" 15 + #include "util/synthetic-events.h" 15 16 #include "thread_map.h" 16 17 #include <linux/zalloc.h> 17 18
+103
tools/perf/util/synthetic-events.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __PERF_SYNTHETIC_EVENTS_H 3 + #define __PERF_SYNTHETIC_EVENTS_H 4 + 5 + #include <stdbool.h> 6 + #include <sys/types.h> // pid_t 7 + #include <linux/compiler.h> 8 + #include <linux/types.h> 9 + 10 + struct auxtrace_record; 11 + struct dso; 12 + struct evlist; 13 + struct evsel; 14 + struct machine; 15 + struct perf_counts_values; 16 + struct perf_cpu_map; 17 + struct perf_event_attr; 18 + struct perf_event_mmap_page; 19 + struct perf_sample; 20 + struct perf_session; 21 + struct perf_stat_config; 22 + struct perf_thread_map; 23 + struct perf_tool; 24 + struct record_opts; 25 + struct target; 26 + 27 + union perf_event; 28 + 29 + typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *event, 30 + struct perf_sample *sample, struct machine *machine); 31 + 32 + int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process); 33 + int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process); 34 + int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine); 35 + int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine); 36 + int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 37 + int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 38 + int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 39 + int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process); 40 + int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe); 41 + int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 42 + int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process); 43 + int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine); 44 + int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 45 + int perf_event__synthesize_mmap_events(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine, bool mmap_data); 46 + int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 47 + int perf_event__synthesize_namespaces(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine); 48 + int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format, const struct perf_sample *sample); 49 + int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine); 50 + int perf_event__synthesize_stat_events(struct perf_stat_config *config, struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process, bool attrs); 51 + int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine); 52 + int perf_event__synthesize_stat(struct perf_tool *tool, u32 cpu, u32 thread, u64 id, struct perf_counts_values *count, perf_event__handler_t process, struct machine *machine); 53 + int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine); 54 + int perf_event__synthesize_thread_map(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine, bool mmap_data); 55 + int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int nr_threads_synthesize); 56 + int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process); 57 + int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, struct perf_tool *tool, perf_event__handler_t process, struct machine *machine); 58 + pid_t perf_event__synthesize_comm(struct perf_tool *tool, union perf_event *event, pid_t pid, perf_event__handler_t process, struct machine *machine); 59 + 60 + int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process); 61 + 62 + size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format); 63 + 64 + int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, 65 + struct target *target, struct perf_thread_map *threads, 66 + perf_event__handler_t process, bool data_mmap, 67 + unsigned int nr_threads_synthesize); 68 + int machine__synthesize_threads(struct machine *machine, struct target *target, 69 + struct perf_thread_map *threads, bool data_mmap, 70 + unsigned int nr_threads_synthesize); 71 + 72 + #ifdef HAVE_AUXTRACE_SUPPORT 73 + int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, struct perf_tool *tool, 74 + struct perf_session *session, perf_event__handler_t process); 75 + 76 + #else // HAVE_AUXTRACE_SUPPORT 77 + 78 + #include <errno.h> 79 + 80 + static inline int 81 + perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused, 82 + struct perf_tool *tool __maybe_unused, 83 + struct perf_session *session __maybe_unused, 84 + perf_event__handler_t process __maybe_unused) 85 + { 86 + return -EINVAL; 87 + } 88 + #endif // HAVE_AUXTRACE_SUPPORT 89 + 90 + #ifdef HAVE_LIBBPF_SUPPORT 91 + int perf_event__synthesize_bpf_events(struct perf_session *session, perf_event__handler_t process, 92 + struct machine *machine, struct record_opts *opts); 93 + #else // HAVE_LIBBPF_SUPPORT 94 + static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused, 95 + perf_event__handler_t process __maybe_unused, 96 + struct machine *machine __maybe_unused, 97 + struct record_opts *opts __maybe_unused) 98 + { 99 + return 0; 100 + } 101 + #endif // HAVE_LIBBPF_SUPPORT 102 + 103 + #endif // __PERF_SYNTHETIC_EVENTS_H
+2 -12
tools/perf/util/tsc.h
··· 4 4 5 5 #include <linux/types.h> 6 6 7 - #include "event.h" 8 - 9 7 struct perf_tsc_conversion { 10 8 u16 time_shift; 11 9 u32 time_mult; 12 10 u64 time_zero; 13 11 }; 12 + 14 13 struct perf_event_mmap_page; 15 14 16 15 int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, ··· 19 20 u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc); 20 21 u64 rdtsc(void); 21 22 22 - struct perf_event_mmap_page; 23 - struct perf_tool; 24 - struct machine; 25 - 26 - int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, 27 - struct perf_tool *tool, 28 - perf_event__handler_t process, 29 - struct machine *machine); 30 - 31 - #endif 23 + #endif // __PERF_TSC_H