synthetic-events.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __PERF_SYNTHETIC_EVENTS_H
  3. #define __PERF_SYNTHETIC_EVENTS_H
  4. #include <stdbool.h>
  5. #include <sys/types.h> // pid_t
  6. #include <linux/compiler.h>
  7. #include <linux/types.h>
  8. struct auxtrace_record;
  9. struct dso;
  10. struct evlist;
  11. struct evsel;
  12. struct machine;
  13. struct perf_counts_values;
  14. struct perf_cpu_map;
  15. struct perf_event_attr;
  16. struct perf_event_mmap_page;
  17. struct perf_sample;
  18. struct perf_session;
  19. struct perf_stat_config;
  20. struct perf_thread_map;
  21. struct perf_tool;
  22. struct record_opts;
  23. struct target;
  24. union perf_event;
  25. typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *event,
  26. struct perf_sample *sample, struct machine *machine);
  27. int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process);
  28. int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process);
  29. int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine);
  30. int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine);
  31. int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
  32. int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
  33. int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
  34. int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
  35. int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe);
  36. int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
  37. int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process);
  38. int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine);
  39. int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
  40. 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);
  41. int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
  42. 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);
  43. int perf_event__synthesize_cgroups(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
  44. int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format, const struct perf_sample *sample);
  45. int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine);
  46. 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);
  47. int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine);
  48. 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);
  49. int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine);
  50. 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);
  51. 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);
  52. int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process);
  53. 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);
  54. 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);
  55. int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process);
  56. size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format);
  57. int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
  58. struct target *target, struct perf_thread_map *threads,
  59. perf_event__handler_t process, bool data_mmap,
  60. unsigned int nr_threads_synthesize);
  61. int machine__synthesize_threads(struct machine *machine, struct target *target,
  62. struct perf_thread_map *threads, bool data_mmap,
  63. unsigned int nr_threads_synthesize);
  64. #ifdef HAVE_AUXTRACE_SUPPORT
  65. int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, struct perf_tool *tool,
  66. struct perf_session *session, perf_event__handler_t process);
  67. #else // HAVE_AUXTRACE_SUPPORT
  68. #include <errno.h>
  69. static inline int
  70. perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
  71. struct perf_tool *tool __maybe_unused,
  72. struct perf_session *session __maybe_unused,
  73. perf_event__handler_t process __maybe_unused)
  74. {
  75. return -EINVAL;
  76. }
  77. #endif // HAVE_AUXTRACE_SUPPORT
  78. #ifdef HAVE_LIBBPF_SUPPORT
  79. int perf_event__synthesize_bpf_events(struct perf_session *session, perf_event__handler_t process,
  80. struct machine *machine, struct record_opts *opts);
  81. #else // HAVE_LIBBPF_SUPPORT
  82. static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
  83. perf_event__handler_t process __maybe_unused,
  84. struct machine *machine __maybe_unused,
  85. struct record_opts *opts __maybe_unused)
  86. {
  87. return 0;
  88. }
  89. #endif // HAVE_LIBBPF_SUPPORT
  90. #endif // __PERF_SYNTHETIC_EVENTS_H