Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
Note: File does not exist in v4.17.
  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
 10struct auxtrace_record;
 11struct dso;
 12struct evlist;
 13struct evsel;
 14struct machine;
 15struct perf_counts_values;
 16struct perf_cpu_map;
 17struct perf_event_attr;
 18struct perf_event_mmap_page;
 19struct perf_sample;
 20struct perf_session;
 21struct perf_stat_config;
 22struct perf_thread_map;
 23struct perf_tool;
 24struct record_opts;
 25struct target;
 26
 27union perf_event;
 28
 29typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *event,
 30				     struct perf_sample *sample, struct machine *machine);
 31
 32int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process);
 33int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process);
 34int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine);
 35int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine);
 36int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
 37int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
 38int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
 39int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
 40int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe);
 41int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
 42int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process);
 43int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine);
 44int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
 45int 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);
 46int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
 47int 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);
 48int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format, const struct perf_sample *sample);
 49int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine);
 50int perf_event__synthesize_stat_events(struct perf_stat_config *config, struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process, bool attrs);
 51int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine);
 52int 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);
 53int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine);
 54int 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);
 55int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, bool mmap_data, unsigned int nr_threads_synthesize);
 56int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process);
 57int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc, struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
 58pid_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
 60int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process);
 61
 62size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format);
 63
 64int __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);
 68int 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
 73int 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
 80static inline int
 81perf_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
 91int 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
 94static 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