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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent bd23ac11
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "../../../../arch/x86/include/asm/insn.h" #include "../../../../arch/x86/include/asm/insn.h"
#include "archinsn.h" #include "archinsn.h"
#include "event.h"
#include "machine.h" #include "machine.h"
#include "thread.h" #include "thread.h"
#include "symbol.h" #include "symbol.h"
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include "../../util/event.h"
#include "../../util/synthetic-events.h"
#include "../../util/machine.h" #include "../../util/machine.h"
#include "../../util/tool.h" #include "../../util/tool.h"
#include "../../util/map.h" #include "../../util/map.h"
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
#include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include "../../util/util.h" // page_size #include "../../util/util.h" // page_size
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include "../../../util/debug.h" #include "../../../util/debug.h"
#include "../../../util/event.h"
#include "../../../util/synthetic-events.h"
#include "../../../util/tsc.h" #include "../../../util/tsc.h"
int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "util/auxtrace.h" #include "util/auxtrace.h"
#include "util/jit.h" #include "util/jit.h"
#include "util/symbol.h" #include "util/symbol.h"
#include "util/synthetic-events.h"
#include "util/thread.h" #include "util/thread.h"
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "util/debug.h" #include "util/debug.h"
#include "util/tool.h" #include "util/tool.h"
#include "util/stat.h" #include "util/stat.h"
#include "util/synthetic-events.h"
#include "util/top.h" #include "util/top.h"
#include "util/data.h" #include "util/data.h"
#include "util/ordered-events.h" #include "util/ordered-events.h"
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "util/trigger.h" #include "util/trigger.h"
#include "util/perf-hooks.h" #include "util/perf-hooks.h"
#include "util/cpu-set-sched.h" #include "util/cpu-set-sched.h"
#include "util/synthetic-events.h"
#include "util/time-utils.h" #include "util/time-utils.h"
#include "util/units.h" #include "util/units.h"
#include "util/bpf-event.h" #include "util/bpf-event.h"
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "util/tool.h" #include "util/tool.h"
#include "util/string2.h" #include "util/string2.h"
#include "util/metricgroup.h" #include "util/metricgroup.h"
#include "util/synthetic-events.h"
#include "util/target.h" #include "util/target.h"
#include "util/time-utils.h" #include "util/time-utils.h"
#include "util/top.h" #include "util/top.h"
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "util/map.h" #include "util/map.h"
#include "util/session.h" #include "util/session.h"
#include "util/symbol.h" #include "util/symbol.h"
#include "util/synthetic-events.h"
#include "util/top.h" #include "util/top.h"
#include "util/util.h" #include "util/util.h"
#include <linux/rbtree.h> #include <linux/rbtree.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "util/dso.h" #include "util/dso.h"
#include "util/env.h" #include "util/env.h"
#include "util/event.h" #include "util/event.h"
#include "util/synthetic-events.h"
#include "util/evlist.h" #include "util/evlist.h"
#include "util/evswitch.h" #include "util/evswitch.h"
#include <subcmd/pager.h> #include <subcmd/pager.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "symbol.h" #include "symbol.h"
#include "event.h" #include "event.h"
#include "record.h" #include "record.h"
#include "util/synthetic-events.h"
#include "thread.h" #include "thread.h"
#include "tests.h" #include "tests.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <stdio.h> #include <stdio.h>
#include "cpumap.h" #include "cpumap.h"
#include "event.h" #include "event.h"
#include "util/synthetic-events.h"
#include <string.h> #include <string.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <perf/cpumap.h> #include <perf/cpumap.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "symbol.h" #include "symbol.h"
#include "thread.h" #include "thread.h"
#include "callchain.h" #include "callchain.h"
#include "util/synthetic-events.h"
#if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__) #if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__)
#include "arch-tests.h" #include "arch-tests.h"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "evsel.h" #include "evsel.h"
#include "header.h" #include "header.h"
#include "machine.h" #include "machine.h"
#include "util/synthetic-events.h"
#include "tool.h" #include "tool.h"
#include "tests.h" #include "tests.h"
#include "debug.h" #include "debug.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "util/debug.h" #include "util/debug.h"
#include "util/dso.h" #include "util/dso.h"
#include "util/event.h" // struct perf_sample
#include "util/map.h" #include "util/map.h"
#include "util/symbol.h" #include "util/symbol.h"
#include "util/sort.h" #include "util/sort.h"
...@@ -10,6 +11,7 @@ ...@@ -10,6 +11,7 @@
#include "util/thread.h" #include "util/thread.h"
#include "tests/hists_common.h" #include "tests/hists_common.h"
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/perf_event.h>
static struct { static struct {
u32 pid; u32 pid;
......
...@@ -8,11 +8,13 @@ ...@@ -8,11 +8,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "debug.h" #include "debug.h"
#include "event.h"
#include "tests.h" #include "tests.h"
#include "machine.h" #include "machine.h"
#include "thread_map.h" #include "thread_map.h"
#include "map.h" #include "map.h"
#include "symbol.h" #include "symbol.h"
#include "util/synthetic-events.h"
#include "thread.h" #include "thread.h"
#include "util.h" // page_size #include "util.h" // page_size
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "event.h" #include "event.h"
#include "evsel.h" #include "evsel.h"
#include "debug.h" #include "debug.h"
#include "util/synthetic-events.h"
#include "tests.h" #include "tests.h"
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "stat.h" #include "stat.h"
#include "counts.h" #include "counts.h"
#include "debug.h" #include "debug.h"
#include "util/synthetic-events.h"
static bool has_term(struct perf_record_stat_config *config, static bool has_term(struct perf_record_stat_config *config,
u64 tag, u64 val) u64 tag, u64 val)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "thread_map.h" #include "thread_map.h"
#include "debug.h" #include "debug.h"
#include "event.h" #include "event.h"
#include "util/synthetic-events.h"
#include <linux/zalloc.h> #include <linux/zalloc.h>
#include <perf/event.h> #include <perf/event.h>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "../../util/callchain.h" #include "../../util/callchain.h"
#include "../../util/debug.h" #include "../../util/debug.h"
#include "../../util/event.h"
#include "../../util/hist.h" #include "../../util/hist.h"
#include "../../util/map.h" #include "../../util/map.h"
#include "../../util/map_groups.h" #include "../../util/map_groups.h"
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "pmu.h" #include "pmu.h"
#include "evsel.h" #include "evsel.h"
#include "symbol.h" #include "symbol.h"
#include "util/synthetic-events.h"
#include "thread_map.h" #include "thread_map.h"
#include "asm/bug.h" #include "asm/bug.h"
#include "auxtrace.h" #include "auxtrace.h"
......
...@@ -11,14 +11,13 @@ ...@@ -11,14 +11,13 @@
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> // FILE
#include <linux/list.h> #include <linux/list.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/bitsperlong.h> #include <asm/bitsperlong.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include "event.h"
union perf_event; union perf_event;
struct perf_session; struct perf_session;
struct evlist; struct evlist;
...@@ -27,6 +26,7 @@ struct perf_mmap; ...@@ -27,6 +26,7 @@ struct perf_mmap;
struct perf_sample; struct perf_sample;
struct option; struct option;
struct record_opts; struct record_opts;
struct perf_record_auxtrace_error;
struct perf_record_auxtrace_info; struct perf_record_auxtrace_info;
struct events_stats; struct events_stats;
...@@ -525,10 +525,6 @@ void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int ...@@ -525,10 +525,6 @@ void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int
int code, int cpu, pid_t pid, pid_t tid, u64 ip, int code, int cpu, pid_t pid, pid_t tid, u64 ip,
const char *msg, u64 timestamp); const char *msg, u64 timestamp);
int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
struct perf_tool *tool,
struct perf_session *session,
perf_event__handler_t process);
int perf_event__process_auxtrace_info(struct perf_session *session, int perf_event__process_auxtrace_info(struct perf_session *session,
union perf_event *event); union perf_event *event);
s64 perf_event__process_auxtrace(struct perf_session *session, s64 perf_event__process_auxtrace(struct perf_session *session,
...@@ -605,15 +601,6 @@ void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused) ...@@ -605,15 +601,6 @@ void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
{ {
} }
static inline int
perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
struct perf_tool *tool __maybe_unused,
struct perf_session *session __maybe_unused,
perf_event__handler_t process __maybe_unused)
{
return -EINVAL;
}
static inline static inline
int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
struct evlist *evlist __maybe_unused, struct evlist *evlist __maybe_unused,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "map.h" #include "map.h"
#include "evlist.h" #include "evlist.h"
#include "record.h" #include "record.h"
#include "util/synthetic-events.h"
#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <pthread.h> #include <pthread.h>
#include <api/fd/array.h> #include <api/fd/array.h>
#include "event.h"
#include <stdio.h> #include <stdio.h>
struct bpf_prog_info;
struct machine; struct machine;
union perf_event; union perf_event;
struct perf_env; struct perf_env;
...@@ -33,11 +33,6 @@ struct btf_node { ...@@ -33,11 +33,6 @@ struct btf_node {
#ifdef HAVE_LIBBPF_SUPPORT #ifdef HAVE_LIBBPF_SUPPORT
int machine__process_bpf(struct machine *machine, union perf_event *event, int machine__process_bpf(struct machine *machine, union perf_event *event,
struct perf_sample *sample); struct perf_sample *sample);
int perf_event__synthesize_bpf_events(struct perf_session *session,
perf_event__handler_t process,
struct machine *machine,
struct record_opts *opts);
int bpf_event__add_sb_event(struct evlist **evlist, int bpf_event__add_sb_event(struct evlist **evlist,
struct perf_env *env); struct perf_env *env);
void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info,
...@@ -51,14 +46,6 @@ static inline int machine__process_bpf(struct machine *machine __maybe_unused, ...@@ -51,14 +46,6 @@ static inline int machine__process_bpf(struct machine *machine __maybe_unused,
return 0; return 0;
} }
static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
perf_event__handler_t process __maybe_unused,
struct machine *machine __maybe_unused,
struct record_opts *opts __maybe_unused)
{
return 0;
}
static inline int bpf_event__add_sb_event(struct evlist **evlist __maybe_unused, static inline int bpf_event__add_sb_event(struct evlist **evlist __maybe_unused,
struct perf_env *env __maybe_unused) struct perf_env *env __maybe_unused)
{ {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "debug.h" #include "debug.h"
#include "dso.h" #include "dso.h"
#include "event.h"
#include "hist.h" #include "hist.h"
#include "sort.h" #include "sort.h"
#include "machine.h" #include "machine.h"
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "stat.h" #include "stat.h"
#include "session.h" #include "session.h"
#include "bpf-event.h" #include "bpf-event.h"
#include "synthetic-events.h"
#include "tool.h" #include "tool.h"
#include "../perf.h" #include "../perf.h"
......
...@@ -279,95 +279,13 @@ enum { ...@@ -279,95 +279,13 @@ enum {
void perf_event__print_totals(void); void perf_event__print_totals(void);
struct evlist;
struct evsel;
struct perf_session;
struct perf_tool;
struct perf_thread_map;
struct perf_cpu_map; struct perf_cpu_map;
struct perf_record_stat_config;
struct perf_stat_config; struct perf_stat_config;
struct perf_counts_values; struct perf_tool;
typedef int (*perf_event__handler_t)(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct machine *machine);
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);
int perf_event__synthesize_attr(struct perf_tool *tool,
struct perf_event_attr *attr, u32 ids, u64 *id,
perf_event__handler_t process);
int perf_event__synthesize_attrs(struct perf_tool *tool,
struct evlist *evlist,
perf_event__handler_t process);
int perf_event__synthesize_build_id(struct perf_tool *tool,
struct dso *pos, u16 misc,
perf_event__handler_t process,
struct machine *machine);
int perf_event__synthesize_extra_attr(struct perf_tool *tool,
struct evlist *evsel_list,
perf_event__handler_t process,
bool is_pipe);
int perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
struct evsel *evsel,
perf_event__handler_t process);
int perf_event__synthesize_event_update_name(struct perf_tool *tool,
struct evsel *evsel,
perf_event__handler_t process);
int perf_event__synthesize_event_update_scale(struct perf_tool *tool,
struct evsel *evsel,
perf_event__handler_t process);
int perf_event__synthesize_event_update_unit(struct perf_tool *tool,
struct evsel *evsel,
perf_event__handler_t process);
int perf_event__synthesize_features(struct perf_tool *tool,
struct perf_session *session,
struct evlist *evlist,
perf_event__handler_t process);
int perf_event__synthesize_tracing_data(struct perf_tool *tool,
int fd, struct evlist *evlist,
perf_event__handler_t process);
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);
int perf_event__synthesize_thread_map2(struct perf_tool *tool,
struct perf_thread_map *threads,
perf_event__handler_t process,
struct machine *machine);
int perf_event__synthesize_cpu_map(struct perf_tool *tool,
struct perf_cpu_map *cpus,
perf_event__handler_t process,
struct machine *machine);
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);
int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
perf_event__handler_t process,
struct machine *machine);
int perf_event__synthesize_stat_config(struct perf_tool *tool,
struct perf_stat_config *config,
perf_event__handler_t process,
struct machine *machine);
void perf_event__read_stat_config(struct perf_stat_config *config, void perf_event__read_stat_config(struct perf_stat_config *config,
struct perf_record_stat_config *event); struct perf_record_stat_config *event);
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);
int perf_event__synthesize_stat_round(struct perf_tool *tool,
u64 time, u64 type,
perf_event__handler_t process,
struct machine *machine);
int perf_event__synthesize_modules(struct perf_tool *tool,
perf_event__handler_t process,
struct machine *machine);
int perf_event__process_comm(struct perf_tool *tool, int perf_event__process_comm(struct perf_tool *tool,
union perf_event *event, union perf_event *event,
...@@ -421,10 +339,6 @@ int perf_event__process_bpf(struct perf_tool *tool, ...@@ -421,10 +339,6 @@ int perf_event__process_bpf(struct perf_tool *tool,
union perf_event *event, union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
struct machine *machine); struct machine *machine);
int perf_tool__process_synth_event(struct perf_tool *tool,
union perf_event *event,
struct machine *machine,
perf_event__handler_t process);
int perf_event__process(struct perf_tool *tool, int perf_event__process(struct perf_tool *tool,
union perf_event *event, union perf_event *event,
struct perf_sample *sample, struct perf_sample *sample,
...@@ -446,34 +360,6 @@ void thread__resolve(struct thread *thread, struct addr_location *al, ...@@ -446,34 +360,6 @@ void thread__resolve(struct thread *thread, struct addr_location *al,
const char *perf_event__name(unsigned int id); const char *perf_event__name(unsigned int id);
size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
u64 read_format);
int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format,
const struct perf_sample *sample);
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);
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);
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);
int perf_event__synthesize_extra_kmaps(struct perf_tool *tool,
perf_event__handler_t process,
struct machine *machine);
size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp); size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "trace-event.h" #include "trace-event.h"
#include "stat.h" #include "stat.h"
#include "string2.h" #include "string2.h"
#include "util/synthetic-events.h"
#include "memswap.h" #include "memswap.h"
#include "util.h" #include "util.h"
#include "../perf-sys.h" #include "../perf-sys.h"
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "util.h" // page_size, perf_exe() #include "util.h" // page_size, perf_exe()
#include "cputopo.h" #include "cputopo.h"
#include "bpf-event.h" #include "bpf-event.h"
#include "util/synthetic-events.h"
#include <linux/ctype.h> #include <linux/ctype.h>
#include <internal/lib.h> #include <internal/lib.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "auxtrace.h" #include "auxtrace.h"
#include "intel-pt-decoder/intel-pt-insn-decoder.h" #include "intel-pt-decoder/intel-pt-insn-decoder.h"
#include "intel-bts.h" #include "intel-bts.h"
#include "util/synthetic-events.h"
#define MAX_TIMESTAMP (~0ULL) #define MAX_TIMESTAMP (~0ULL)
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "tsc.h" #include "tsc.h"
#include "intel-pt.h" #include "intel-pt.h"
#include "config.h" #include "config.h"
#include "util/synthetic-events.h"
#include "time-utils.h" #include "time-utils.h"
#include "../arch/x86/include/uapi/asm/perf_regs.h" #include "../arch/x86/include/uapi/asm/perf_regs.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "symbol.h" #include "symbol.h"
#include "sort.h" #include "sort.h"
#include "strlist.h" #include "strlist.h"
#include "util/synthetic-events.h"
#include "target.h" #include "target.h"
#include "thread.h" #include "thread.h"
#include "util.h" #include "util.h"
...@@ -2624,6 +2625,15 @@ int __machine__synthesize_threads(struct machine *machine, struct perf_tool *too ...@@ -2624,6 +2625,15 @@ int __machine__synthesize_threads(struct machine *machine, struct perf_tool *too
return 0; return 0;
} }
int machine__synthesize_threads(struct machine *machine, struct target *target,
struct perf_thread_map *threads, bool data_mmap,
unsigned int nr_threads_synthesize)
{
return __machine__synthesize_threads(machine, NULL, target, threads,
perf_event__process, data_mmap,
nr_threads_synthesize);
}
pid_t machine__get_current_tid(struct machine *machine, int cpu) pid_t machine__get_current_tid(struct machine *machine, int cpu)
{ {
int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS); int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include "map_groups.h" #include "map_groups.h"
#include "dsos.h" #include "dsos.h"
#include "event.h"
#include "rwsem.h" #include "rwsem.h"
struct addr_location; struct addr_location;
...@@ -252,20 +251,6 @@ int machines__for_each_thread(struct machines *machines, ...@@ -252,20 +251,6 @@ int machines__for_each_thread(struct machines *machines,
int (*fn)(struct thread *thread, void *p), int (*fn)(struct thread *thread, void *p),
void *priv); void *priv);
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
struct target *target, struct perf_thread_map *threads,
perf_event__handler_t process, bool data_mmap,
unsigned int nr_threads_synthesize);
static inline
int machine__synthesize_threads(struct machine *machine, struct target *target,
struct perf_thread_map *threads, bool data_mmap,
unsigned int nr_threads_synthesize)
{
return __machine__synthesize_threads(machine, NULL, target, threads,
perf_event__process, data_mmap,
nr_threads_synthesize);
}
pid_t machine__get_current_tid(struct machine *machine, int cpu); pid_t machine__get_current_tid(struct machine *machine, int cpu);
int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
pid_t tid); pid_t tid);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "thread-stack.h" #include "thread-stack.h"
#include "sample-raw.h" #include "sample-raw.h"
#include "stat.h" #include "stat.h"
#include "util/synthetic-events.h"
#include "util.h" #include "util.h"
#include "ui/progress.h" #include "ui/progress.h"
#include "../perf.h" #include "../perf.h"
......
...@@ -138,9 +138,4 @@ int perf_session__deliver_synth_event(struct perf_session *session, ...@@ -138,9 +138,4 @@ int perf_session__deliver_synth_event(struct perf_session *session,
int perf_event__process_id_index(struct perf_session *session, int perf_event__process_id_index(struct perf_session *session,
union perf_event *event); union perf_event *event);
int perf_event__synthesize_id_index(struct perf_tool *tool,
perf_event__handler_t process,
struct evlist *evlist,
struct machine *machine);
#endif /* __PERF_SESSION_H */ #endif /* __PERF_SESSION_H */
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "target.h" #include "target.h"
#include "evlist.h" #include "evlist.h"
#include "evsel.h" #include "evsel.h"
#include "util/synthetic-events.h"
#include "thread_map.h" #include "thread_map.h"
#include <linux/zalloc.h> #include <linux/zalloc.h>
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __PERF_SYNTHETIC_EVENTS_H
#define __PERF_SYNTHETIC_EVENTS_H
#include <stdbool.h>
#include <sys/types.h> // pid_t
#include <linux/compiler.h>
#include <linux/types.h>
struct auxtrace_record;
struct dso;
struct evlist;
struct evsel;
struct machine;
struct perf_counts_values;
struct perf_cpu_map;
struct perf_event_attr;
struct perf_event_mmap_page;
struct perf_sample;
struct perf_session;
struct perf_stat_config;
struct perf_thread_map;
struct perf_tool;
struct record_opts;
struct target;
union perf_event;
typedef int (*perf_event__handler_t)(struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample, struct machine *machine);
int perf_event__synthesize_attrs(struct perf_tool *tool, struct evlist *evlist, perf_event__handler_t process);
int perf_event__synthesize_attr(struct perf_tool *tool, struct perf_event_attr *attr, u32 ids, u64 *id, perf_event__handler_t process);
int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 misc, perf_event__handler_t process, struct machine *machine);
int perf_event__synthesize_cpu_map(struct perf_tool *tool, struct perf_cpu_map *cpus, perf_event__handler_t process, struct machine *machine);
int perf_event__synthesize_event_update_cpus(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_event_update_scale(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_event_update_unit(struct perf_tool *tool, struct evsel *evsel, perf_event__handler_t process);
int perf_event__synthesize_extra_attr(struct perf_tool *tool, struct evlist *evsel_list, perf_event__handler_t process, bool is_pipe);
int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
int perf_event__synthesize_features(struct perf_tool *tool, struct perf_session *session, struct evlist *evlist, perf_event__handler_t process);
int perf_event__synthesize_id_index(struct perf_tool *tool, perf_event__handler_t process, struct evlist *evlist, struct machine *machine);
int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
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);
int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine);
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);
int perf_event__synthesize_sample(union perf_event *event, u64 type, u64 read_format, const struct perf_sample *sample);
int perf_event__synthesize_stat_config(struct perf_tool *tool, struct perf_stat_config *config, perf_event__handler_t process, struct machine *machine);
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);
int perf_event__synthesize_stat_round(struct perf_tool *tool, u64 time, u64 type, perf_event__handler_t process, struct machine *machine);
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);
int perf_event__synthesize_thread_map2(struct perf_tool *tool, struct perf_thread_map *threads, perf_event__handler_t process, struct machine *machine);
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);
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);
int perf_event__synthesize_tracing_data(struct perf_tool *tool, int fd, struct evlist *evlist, perf_event__handler_t process);
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);
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);
int perf_tool__process_synth_event(struct perf_tool *tool, union perf_event *event, struct machine *machine, perf_event__handler_t process);
size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format);
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
struct target *target, struct perf_thread_map *threads,
perf_event__handler_t process, bool data_mmap,
unsigned int nr_threads_synthesize);
int machine__synthesize_threads(struct machine *machine, struct target *target,
struct perf_thread_map *threads, bool data_mmap,
unsigned int nr_threads_synthesize);
#ifdef HAVE_AUXTRACE_SUPPORT
int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr, struct perf_tool *tool,
struct perf_session *session, perf_event__handler_t process);
#else // HAVE_AUXTRACE_SUPPORT
#include <errno.h>
static inline int
perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
struct perf_tool *tool __maybe_unused,
struct perf_session *session __maybe_unused,
perf_event__handler_t process __maybe_unused)
{
return -EINVAL;
}
#endif // HAVE_AUXTRACE_SUPPORT
#ifdef HAVE_LIBBPF_SUPPORT
int perf_event__synthesize_bpf_events(struct perf_session *session, perf_event__handler_t process,
struct machine *machine, struct record_opts *opts);
#else // HAVE_LIBBPF_SUPPORT
static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
perf_event__handler_t process __maybe_unused,
struct machine *machine __maybe_unused,
struct record_opts *opts __maybe_unused)
{
return 0;
}
#endif // HAVE_LIBBPF_SUPPORT
#endif // __PERF_SYNTHETIC_EVENTS_H
...@@ -4,13 +4,12 @@ ...@@ -4,13 +4,12 @@
#include <linux/types.h> #include <linux/types.h>
#include "event.h"
struct perf_tsc_conversion { struct perf_tsc_conversion {
u16 time_shift; u16 time_shift;
u32 time_mult; u32 time_mult;
u64 time_zero; u64 time_zero;
}; };
struct perf_event_mmap_page; struct perf_event_mmap_page;
int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
...@@ -20,13 +19,4 @@ u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc); ...@@ -20,13 +19,4 @@ u64 perf_time_to_tsc(u64 ns, struct perf_tsc_conversion *tc);
u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc); u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc);
u64 rdtsc(void); u64 rdtsc(void);
struct perf_event_mmap_page; #endif // __PERF_TSC_H
struct perf_tool;
struct machine;
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);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment