aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/arch/x86/util/archinsn.c1
-rw-r--r--tools/perf/arch/x86/util/event.c2
-rw-r--r--tools/perf/arch/x86/util/machine.c1
-rw-r--r--tools/perf/arch/x86/util/tsc.c2
-rw-r--r--tools/perf/builtin-inject.c1
-rw-r--r--tools/perf/builtin-kvm.c1
-rw-r--r--tools/perf/builtin-record.c1
-rw-r--r--tools/perf/builtin-stat.c1
-rw-r--r--tools/perf/builtin-top.c1
-rw-r--r--tools/perf/builtin-trace.c1
-rw-r--r--tools/perf/tests/code-reading.c1
-rw-r--r--tools/perf/tests/cpumap.c1
-rw-r--r--tools/perf/tests/dwarf-unwind.c1
-rw-r--r--tools/perf/tests/event_update.c1
-rw-r--r--tools/perf/tests/hists_common.c2
-rw-r--r--tools/perf/tests/mmap-thread-lookup.c2
-rw-r--r--tools/perf/tests/sample-parsing.c1
-rw-r--r--tools/perf/tests/stat.c1
-rw-r--r--tools/perf/tests/thread-map.c1
-rw-r--r--tools/perf/ui/stdio/hist.c1
-rw-r--r--tools/perf/util/auxtrace.c1
-rw-r--r--tools/perf/util/auxtrace.h17
-rw-r--r--tools/perf/util/bpf-event.c1
-rw-r--r--tools/perf/util/bpf-event.h15
-rw-r--r--tools/perf/util/callchain.c1
-rw-r--r--tools/perf/util/event.c1
-rw-r--r--tools/perf/util/event.h118
-rw-r--r--tools/perf/util/evsel.c1
-rw-r--r--tools/perf/util/header.c1
-rw-r--r--tools/perf/util/intel-bts.c1
-rw-r--r--tools/perf/util/intel-pt.c1
-rw-r--r--tools/perf/util/machine.c10
-rw-r--r--tools/perf/util/machine.h15
-rw-r--r--tools/perf/util/session.c1
-rw-r--r--tools/perf/util/session.h5
-rw-r--r--tools/perf/util/stat.c1
-rw-r--r--tools/perf/util/synthetic-events.h103
-rw-r--r--tools/perf/util/tsc.h14
38 files changed, 154 insertions, 177 deletions
diff --git a/tools/perf/arch/x86/util/archinsn.c b/tools/perf/arch/x86/util/archinsn.c
index 9876c7a7ed7c..3e6791531ca5 100644
--- a/tools/perf/arch/x86/util/archinsn.c
+++ b/tools/perf/arch/x86/util/archinsn.c
@@ -1,6 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include "../../../../arch/x86/include/asm/insn.h" 2#include "../../../../arch/x86/include/asm/insn.h"
3#include "archinsn.h" 3#include "archinsn.h"
4#include "event.h"
4#include "machine.h" 5#include "machine.h"
5#include "thread.h" 6#include "thread.h"
6#include "symbol.h" 7#include "symbol.h"
diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c
index a3a0b6884779..d357c625c09f 100644
--- a/tools/perf/arch/x86/util/event.c
+++ b/tools/perf/arch/x86/util/event.c
@@ -3,6 +3,8 @@
3#include <linux/string.h> 3#include <linux/string.h>
4#include <linux/zalloc.h> 4#include <linux/zalloc.h>
5 5
6#include "../../util/event.h"
7#include "../../util/synthetic-events.h"
6#include "../../util/machine.h" 8#include "../../util/machine.h"
7#include "../../util/tool.h" 9#include "../../util/tool.h"
8#include "../../util/map.h" 10#include "../../util/map.h"
diff --git a/tools/perf/arch/x86/util/machine.c b/tools/perf/arch/x86/util/machine.c
index 42418040bc07..f0c289862f9f 100644
--- a/tools/perf/arch/x86/util/machine.c
+++ b/tools/perf/arch/x86/util/machine.c
@@ -1,6 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include <linux/types.h> 2#include <linux/types.h>
3#include <linux/string.h> 3#include <linux/string.h>
4#include <limits.h>
4#include <stdlib.h> 5#include <stdlib.h>
5 6
6#include "../../util/util.h" // page_size 7#include "../../util/util.h" // page_size
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
index c5197a15119b..2f55afb14e1f 100644
--- a/tools/perf/arch/x86/util/tsc.c
+++ b/tools/perf/arch/x86/util/tsc.c
@@ -8,6 +8,8 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <asm/barrier.h> 9#include <asm/barrier.h>
10#include "../../../util/debug.h" 10#include "../../../util/debug.h"
11#include "../../../util/event.h"
12#include "../../../util/synthetic-events.h"
11#include "../../../util/tsc.h" 13#include "../../../util/tsc.h"
12 14
13int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, 15int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc,
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index c14f40b858bc..23a76cf3846f 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -21,6 +21,7 @@
21#include "util/auxtrace.h" 21#include "util/auxtrace.h"
22#include "util/jit.h" 22#include "util/jit.h"
23#include "util/symbol.h" 23#include "util/symbol.h"
24#include "util/synthetic-events.h"
24#include "util/thread.h" 25#include "util/thread.h"
25 26
26#include <subcmd/parse-options.h> 27#include <subcmd/parse-options.h>
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 0a4fcbe32bf6..ac6d6e061dc5 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -17,6 +17,7 @@
17#include "util/debug.h" 17#include "util/debug.h"
18#include "util/tool.h" 18#include "util/tool.h"
19#include "util/stat.h" 19#include "util/stat.h"
20#include "util/synthetic-events.h"
20#include "util/top.h" 21#include "util/top.h"
21#include "util/data.h" 22#include "util/data.h"
22#include "util/ordered-events.h" 23#include "util/ordered-events.h"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 1447004eee8a..907d4d4677a3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -38,6 +38,7 @@
38#include "util/trigger.h" 38#include "util/trigger.h"
39#include "util/perf-hooks.h" 39#include "util/perf-hooks.h"
40#include "util/cpu-set-sched.h" 40#include "util/cpu-set-sched.h"
41#include "util/synthetic-events.h"
41#include "util/time-utils.h" 42#include "util/time-utils.h"
42#include "util/units.h" 43#include "util/units.h"
43#include "util/bpf-event.h" 44#include "util/bpf-event.h"
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index b55e8060810b..eece3d1e429a 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -61,6 +61,7 @@
61#include "util/tool.h" 61#include "util/tool.h"
62#include "util/string2.h" 62#include "util/string2.h"
63#include "util/metricgroup.h" 63#include "util/metricgroup.h"
64#include "util/synthetic-events.h"
64#include "util/target.h" 65#include "util/target.h"
65#include "util/time-utils.h" 66#include "util/time-utils.h"
66#include "util/top.h" 67#include "util/top.h"
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 726e3f2dd8c7..b052470f89b4 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -32,6 +32,7 @@
32#include "util/map.h" 32#include "util/map.h"
33#include "util/session.h" 33#include "util/session.h"
34#include "util/symbol.h" 34#include "util/symbol.h"
35#include "util/synthetic-events.h"
35#include "util/top.h" 36#include "util/top.h"
36#include "util/util.h" 37#include "util/util.h"
37#include <linux/rbtree.h> 38#include <linux/rbtree.h>
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 0f633f0d6be8..f0f735093e21 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -28,6 +28,7 @@
28#include "util/dso.h" 28#include "util/dso.h"
29#include "util/env.h" 29#include "util/env.h"
30#include "util/event.h" 30#include "util/event.h"
31#include "util/synthetic-events.h"
31#include "util/evlist.h" 32#include "util/evlist.h"
32#include "util/evswitch.h" 33#include "util/evswitch.h"
33#include <subcmd/pager.h> 34#include <subcmd/pager.h>
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 8d9020c46ca9..fd02c1f1d976 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -24,6 +24,7 @@
24#include "symbol.h" 24#include "symbol.h"
25#include "event.h" 25#include "event.h"
26#include "record.h" 26#include "record.h"
27#include "util/synthetic-events.h"
27#include "thread.h" 28#include "thread.h"
28 29
29#include "tests.h" 30#include "tests.h"
diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c
index 39493de50117..8a0d236202b0 100644
--- a/tools/perf/tests/cpumap.c
+++ b/tools/perf/tests/cpumap.c
@@ -3,6 +3,7 @@
3#include <stdio.h> 3#include <stdio.h>
4#include "cpumap.h" 4#include "cpumap.h"
5#include "event.h" 5#include "event.h"
6#include "util/synthetic-events.h"
6#include <string.h> 7#include <string.h>
7#include <linux/bitops.h> 8#include <linux/bitops.h>
8#include <perf/cpumap.h> 9#include <perf/cpumap.h>
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index 4125255ff637..4f4ecbcbe87e 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -15,6 +15,7 @@
15#include "symbol.h" 15#include "symbol.h"
16#include "thread.h" 16#include "thread.h"
17#include "callchain.h" 17#include "callchain.h"
18#include "util/synthetic-events.h"
18 19
19#if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__) 20#if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__)
20#include "arch-tests.h" 21#include "arch-tests.h"
diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c
index 317eb8c5ccd4..4bb772e2b73d 100644
--- a/tools/perf/tests/event_update.c
+++ b/tools/perf/tests/event_update.c
@@ -7,6 +7,7 @@
7#include "evsel.h" 7#include "evsel.h"
8#include "header.h" 8#include "header.h"
9#include "machine.h" 9#include "machine.h"
10#include "util/synthetic-events.h"
10#include "tool.h" 11#include "tool.h"
11#include "tests.h" 12#include "tests.h"
12#include "debug.h" 13#include "debug.h"
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index de110d8f169b..6f34d08b84e5 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -2,6 +2,7 @@
2#include <inttypes.h> 2#include <inttypes.h>
3#include "util/debug.h" 3#include "util/debug.h"
4#include "util/dso.h" 4#include "util/dso.h"
5#include "util/event.h" // struct perf_sample
5#include "util/map.h" 6#include "util/map.h"
6#include "util/symbol.h" 7#include "util/symbol.h"
7#include "util/sort.h" 8#include "util/sort.h"
@@ -10,6 +11,7 @@
10#include "util/thread.h" 11#include "util/thread.h"
11#include "tests/hists_common.h" 12#include "tests/hists_common.h"
12#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/perf_event.h>
13 15
14static struct { 16static struct {
15 u32 pid; 17 u32 pid;
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
index f72889c13538..33b496d194f4 100644
--- a/tools/perf/tests/mmap-thread-lookup.c
+++ b/tools/perf/tests/mmap-thread-lookup.c
@@ -8,11 +8,13 @@
8#include <stdlib.h> 8#include <stdlib.h>
9#include <stdio.h> 9#include <stdio.h>
10#include "debug.h" 10#include "debug.h"
11#include "event.h"
11#include "tests.h" 12#include "tests.h"
12#include "machine.h" 13#include "machine.h"
13#include "thread_map.h" 14#include "thread_map.h"
14#include "map.h" 15#include "map.h"
15#include "symbol.h" 16#include "symbol.h"
17#include "util/synthetic-events.h"
16#include "thread.h" 18#include "thread.h"
17#include "util.h" // page_size 19#include "util.h" // page_size
18 20
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index e3b965e7a233..3a02426db9a6 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -12,6 +12,7 @@
12#include "event.h" 12#include "event.h"
13#include "evsel.h" 13#include "evsel.h"
14#include "debug.h" 14#include "debug.h"
15#include "util/synthetic-events.h"
15 16
16#include "tests.h" 17#include "tests.h"
17 18
diff --git a/tools/perf/tests/stat.c b/tools/perf/tests/stat.c
index cc10b4116c9f..c1911501c39c 100644
--- a/tools/perf/tests/stat.c
+++ b/tools/perf/tests/stat.c
@@ -5,6 +5,7 @@
5#include "stat.h" 5#include "stat.h"
6#include "counts.h" 6#include "counts.h"
7#include "debug.h" 7#include "debug.h"
8#include "util/synthetic-events.h"
8 9
9static bool has_term(struct perf_record_stat_config *config, 10static bool has_term(struct perf_record_stat_config *config,
10 u64 tag, u64 val) 11 u64 tag, u64 val)
diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c
index 39168c57943b..28f51c4bd373 100644
--- a/tools/perf/tests/thread-map.c
+++ b/tools/perf/tests/thread-map.c
@@ -8,6 +8,7 @@
8#include "thread_map.h" 8#include "thread_map.h"
9#include "debug.h" 9#include "debug.h"
10#include "event.h" 10#include "event.h"
11#include "util/synthetic-events.h"
11#include <linux/zalloc.h> 12#include <linux/zalloc.h>
12#include <perf/event.h> 13#include <perf/event.h>
13 14
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 832ca6cfbe30..5365606e9dad 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -5,6 +5,7 @@
5 5
6#include "../../util/callchain.h" 6#include "../../util/callchain.h"
7#include "../../util/debug.h" 7#include "../../util/debug.h"
8#include "../../util/event.h"
8#include "../../util/hist.h" 9#include "../../util/hist.h"
9#include "../../util/map.h" 10#include "../../util/map.h"
10#include "../../util/map_groups.h" 11#include "../../util/map_groups.h"
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 1c0ff5acff83..0e8c89cf7cad 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -32,6 +32,7 @@
32#include "pmu.h" 32#include "pmu.h"
33#include "evsel.h" 33#include "evsel.h"
34#include "symbol.h" 34#include "symbol.h"
35#include "util/synthetic-events.h"
35#include "thread_map.h" 36#include "thread_map.h"
36#include "asm/bug.h" 37#include "asm/bug.h"
37#include "auxtrace.h" 38#include "auxtrace.h"
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index 1ed902a24a39..b110aec1da4d 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -11,14 +11,13 @@
11#include <errno.h> 11#include <errno.h>
12#include <stdbool.h> 12#include <stdbool.h>
13#include <stddef.h> 13#include <stddef.h>
14#include <stdio.h> // FILE
14#include <linux/list.h> 15#include <linux/list.h>
15#include <linux/perf_event.h> 16#include <linux/perf_event.h>
16#include <linux/types.h> 17#include <linux/types.h>
17#include <asm/bitsperlong.h> 18#include <asm/bitsperlong.h>
18#include <asm/barrier.h> 19#include <asm/barrier.h>
19 20
20#include "event.h"
21
22union perf_event; 21union perf_event;
23struct perf_session; 22struct perf_session;
24struct evlist; 23struct evlist;
@@ -27,6 +26,7 @@ struct perf_mmap;
27struct perf_sample; 26struct perf_sample;
28struct option; 27struct option;
29struct record_opts; 28struct record_opts;
29struct perf_record_auxtrace_error;
30struct perf_record_auxtrace_info; 30struct perf_record_auxtrace_info;
31struct events_stats; 31struct events_stats;
32 32
@@ -525,10 +525,6 @@ void auxtrace_synth_error(struct perf_record_auxtrace_error *auxtrace_error, int
525 int code, int cpu, pid_t pid, pid_t tid, u64 ip, 525 int code, int cpu, pid_t pid, pid_t tid, u64 ip,
526 const char *msg, u64 timestamp); 526 const char *msg, u64 timestamp);
527 527
528int 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);
532int perf_event__process_auxtrace_info(struct perf_session *session, 528int perf_event__process_auxtrace_info(struct perf_session *session,
533 union perf_event *event); 529 union perf_event *event);
534s64 perf_event__process_auxtrace(struct perf_session *session, 530s64 perf_event__process_auxtrace(struct perf_session *session,
@@ -605,15 +601,6 @@ void auxtrace_record__free(struct auxtrace_record *itr __maybe_unused)
605{ 601{
606} 602}
607 603
608static inline int
609perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr __maybe_unused,
610 struct perf_tool *tool __maybe_unused,
611 struct perf_session *session __maybe_unused,
612 perf_event__handler_t process __maybe_unused)
613{
614 return -EINVAL;
615}
616
617static inline 604static inline
618int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused, 605int auxtrace_record__options(struct auxtrace_record *itr __maybe_unused,
619 struct evlist *evlist __maybe_unused, 606 struct evlist *evlist __maybe_unused,
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index 7a3d4b125323..f7ed5d122e22 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -16,6 +16,7 @@
16#include "map.h" 16#include "map.h"
17#include "evlist.h" 17#include "evlist.h"
18#include "record.h" 18#include "record.h"
19#include "util/synthetic-events.h"
19 20
20#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) 21#define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr))
21 22
diff --git a/tools/perf/util/bpf-event.h b/tools/perf/util/bpf-event.h
index a01c2fd68c03..81fdc88e6c1a 100644
--- a/tools/perf/util/bpf-event.h
+++ b/tools/perf/util/bpf-event.h
@@ -6,9 +6,9 @@
6#include <linux/rbtree.h> 6#include <linux/rbtree.h>
7#include <pthread.h> 7#include <pthread.h>
8#include <api/fd/array.h> 8#include <api/fd/array.h>
9#include "event.h"
10#include <stdio.h> 9#include <stdio.h>
11 10
11struct bpf_prog_info;
12struct machine; 12struct machine;
13union perf_event; 13union perf_event;
14struct perf_env; 14struct perf_env;
@@ -33,11 +33,6 @@ struct btf_node {
33#ifdef HAVE_LIBBPF_SUPPORT 33#ifdef HAVE_LIBBPF_SUPPORT
34int machine__process_bpf(struct machine *machine, union perf_event *event, 34int machine__process_bpf(struct machine *machine, union perf_event *event,
35 struct perf_sample *sample); 35 struct perf_sample *sample);
36
37int perf_event__synthesize_bpf_events(struct perf_session *session,
38 perf_event__handler_t process,
39 struct machine *machine,
40 struct record_opts *opts);
41int bpf_event__add_sb_event(struct evlist **evlist, 36int bpf_event__add_sb_event(struct evlist **evlist,
42 struct perf_env *env); 37 struct perf_env *env);
43void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, 38void 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 return 0; 46 return 0;
52} 47}
53 48
54static inline int perf_event__synthesize_bpf_events(struct perf_session *session __maybe_unused,
55 perf_event__handler_t process __maybe_unused,
56 struct machine *machine __maybe_unused,
57 struct record_opts *opts __maybe_unused)
58{
59 return 0;
60}
61
62static inline int bpf_event__add_sb_event(struct evlist **evlist __maybe_unused, 49static inline int bpf_event__add_sb_event(struct evlist **evlist __maybe_unused,
63 struct perf_env *env __maybe_unused) 50 struct perf_env *env __maybe_unused)
64{ 51{
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index c14646c1f2eb..9a9b56ed3f0a 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -23,6 +23,7 @@
23 23
24#include "debug.h" 24#include "debug.h"
25#include "dso.h" 25#include "dso.h"
26#include "event.h"
26#include "hist.h" 27#include "hist.h"
27#include "sort.h" 28#include "sort.h"
28#include "machine.h" 29#include "machine.h"
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index d65ae7cf9316..043a08fc7398 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -32,6 +32,7 @@
32#include "stat.h" 32#include "stat.h"
33#include "session.h" 33#include "session.h"
34#include "bpf-event.h" 34#include "bpf-event.h"
35#include "synthetic-events.h"
35#include "tool.h" 36#include "tool.h"
36#include "../perf.h" 37#include "../perf.h"
37 38
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 89a2404170a0..a0a0c91cde4a 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -279,95 +279,13 @@ enum {
279 279
280void perf_event__print_totals(void); 280void perf_event__print_totals(void);
281 281
282struct evlist;
283struct evsel;
284struct perf_session;
285struct perf_tool;
286struct perf_thread_map;
287struct perf_cpu_map; 282struct perf_cpu_map;
283struct perf_record_stat_config;
288struct perf_stat_config; 284struct perf_stat_config;
289struct perf_counts_values; 285struct perf_tool;
290
291typedef int (*perf_event__handler_t)(struct perf_tool *tool,
292 union perf_event *event,
293 struct perf_sample *sample,
294 struct machine *machine);
295 286
296int 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);
301int perf_event__synthesize_attr(struct perf_tool *tool,
302 struct perf_event_attr *attr, u32 ids, u64 *id,
303 perf_event__handler_t process);
304int perf_event__synthesize_attrs(struct perf_tool *tool,
305 struct evlist *evlist,
306 perf_event__handler_t process);
307int 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);
311int perf_event__synthesize_extra_attr(struct perf_tool *tool,
312 struct evlist *evsel_list,
313 perf_event__handler_t process,
314 bool is_pipe);
315int perf_event__synthesize_event_update_cpus(struct perf_tool *tool,
316 struct evsel *evsel,
317 perf_event__handler_t process);
318int perf_event__synthesize_event_update_name(struct perf_tool *tool,
319 struct evsel *evsel,
320 perf_event__handler_t process);
321int perf_event__synthesize_event_update_scale(struct perf_tool *tool,
322 struct evsel *evsel,
323 perf_event__handler_t process);
324int perf_event__synthesize_event_update_unit(struct perf_tool *tool,
325 struct evsel *evsel,
326 perf_event__handler_t process);
327int perf_event__synthesize_features(struct perf_tool *tool,
328 struct perf_session *session,
329 struct evlist *evlist,
330 perf_event__handler_t process);
331int perf_event__synthesize_tracing_data(struct perf_tool *tool,
332 int fd, struct evlist *evlist,
333 perf_event__handler_t process);
334int 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);
338int 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);
342int 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);
346int 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);
350int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
351 perf_event__handler_t process,
352 struct machine *machine);
353int 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);
357void perf_event__read_stat_config(struct perf_stat_config *config, 287void perf_event__read_stat_config(struct perf_stat_config *config,
358 struct perf_record_stat_config *event); 288 struct perf_record_stat_config *event);
359int 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);
364int perf_event__synthesize_stat_round(struct perf_tool *tool,
365 u64 time, u64 type,
366 perf_event__handler_t process,
367 struct machine *machine);
368int perf_event__synthesize_modules(struct perf_tool *tool,
369 perf_event__handler_t process,
370 struct machine *machine);
371 289
372int perf_event__process_comm(struct perf_tool *tool, 290int perf_event__process_comm(struct perf_tool *tool,
373 union perf_event *event, 291 union perf_event *event,
@@ -421,10 +339,6 @@ int perf_event__process_bpf(struct perf_tool *tool,
421 union perf_event *event, 339 union perf_event *event,
422 struct perf_sample *sample, 340 struct perf_sample *sample,
423 struct machine *machine); 341 struct machine *machine);
424int perf_tool__process_synth_event(struct perf_tool *tool,
425 union perf_event *event,
426 struct machine *machine,
427 perf_event__handler_t process);
428int perf_event__process(struct perf_tool *tool, 342int perf_event__process(struct perf_tool *tool,
429 union perf_event *event, 343 union perf_event *event,
430 struct perf_sample *sample, 344 struct perf_sample *sample,
@@ -446,34 +360,6 @@ void thread__resolve(struct thread *thread, struct addr_location *al,
446 360
447const char *perf_event__name(unsigned int id); 361const char *perf_event__name(unsigned int id);
448 362
449size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
450 u64 read_format);
451int perf_event__synthesize_sample(union perf_event *event, u64 type,
452 u64 read_format,
453 const struct perf_sample *sample);
454
455pid_t perf_event__synthesize_comm(struct perf_tool *tool,
456 union perf_event *event, pid_t pid,
457 perf_event__handler_t process,
458 struct machine *machine);
459
460int perf_event__synthesize_namespaces(struct perf_tool *tool,
461 union perf_event *event,
462 pid_t pid, pid_t tgid,
463 perf_event__handler_t process,
464 struct machine *machine);
465
466int perf_event__synthesize_mmap_events(struct perf_tool *tool,
467 union perf_event *event,
468 pid_t pid, pid_t tgid,
469 perf_event__handler_t process,
470 struct machine *machine,
471 bool mmap_data);
472
473int perf_event__synthesize_extra_kmaps(struct perf_tool *tool,
474 perf_event__handler_t process,
475 struct machine *machine);
476
477size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); 363size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
478size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); 364size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
479size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp); 365size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 5b40b840624c..5af025c80ec5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -40,6 +40,7 @@
40#include "trace-event.h" 40#include "trace-event.h"
41#include "stat.h" 41#include "stat.h"
42#include "string2.h" 42#include "string2.h"
43#include "util/synthetic-events.h"
43#include "memswap.h" 44#include "memswap.h"
44#include "util.h" 45#include "util.h"
45#include "../perf-sys.h" 46#include "../perf-sys.h"
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d85827de1b60..a4a8342eba98 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -45,6 +45,7 @@
45#include "util.h" // page_size, perf_exe() 45#include "util.h" // page_size, perf_exe()
46#include "cputopo.h" 46#include "cputopo.h"
47#include "bpf-event.h" 47#include "bpf-event.h"
48#include "util/synthetic-events.h"
48 49
49#include <linux/ctype.h> 50#include <linux/ctype.h>
50#include <internal/lib.h> 51#include <internal/lib.h>
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 15f87a09f4fe..3888d4cd3ed1 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -28,6 +28,7 @@
28#include "auxtrace.h" 28#include "auxtrace.h"
29#include "intel-pt-decoder/intel-pt-insn-decoder.h" 29#include "intel-pt-decoder/intel-pt-insn-decoder.h"
30#include "intel-bts.h" 30#include "intel-bts.h"
31#include "util/synthetic-events.h"
31 32
32#define MAX_TIMESTAMP (~0ULL) 33#define MAX_TIMESTAMP (~0ULL)
33 34
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 9b56fb74bedf..bcdc0359f7cf 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -33,6 +33,7 @@
33#include "tsc.h" 33#include "tsc.h"
34#include "intel-pt.h" 34#include "intel-pt.h"
35#include "config.h" 35#include "config.h"
36#include "util/synthetic-events.h"
36#include "time-utils.h" 37#include "time-utils.h"
37 38
38#include "../arch/x86/include/uapi/asm/perf_regs.h" 39#include "../arch/x86/include/uapi/asm/perf_regs.h"
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index b4749d3eed08..132de5cfb9b9 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -20,6 +20,7 @@
20#include "symbol.h" 20#include "symbol.h"
21#include "sort.h" 21#include "sort.h"
22#include "strlist.h" 22#include "strlist.h"
23#include "util/synthetic-events.h"
23#include "target.h" 24#include "target.h"
24#include "thread.h" 25#include "thread.h"
25#include "util.h" 26#include "util.h"
@@ -2624,6 +2625,15 @@ int __machine__synthesize_threads(struct machine *machine, struct perf_tool *too
2624 return 0; 2625 return 0;
2625} 2626}
2626 2627
2628int machine__synthesize_threads(struct machine *machine, struct target *target,
2629 struct perf_thread_map *threads, bool data_mmap,
2630 unsigned int nr_threads_synthesize)
2631{
2632 return __machine__synthesize_threads(machine, NULL, target, threads,
2633 perf_event__process, data_mmap,
2634 nr_threads_synthesize);
2635}
2636
2627pid_t machine__get_current_tid(struct machine *machine, int cpu) 2637pid_t machine__get_current_tid(struct machine *machine, int cpu)
2628{ 2638{
2629 int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS); 2639 int nr_cpus = min(machine->env->nr_cpus_online, MAX_NR_CPUS);
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index ffd391a925a6..18e13c0ccd6a 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -6,7 +6,6 @@
6#include <linux/rbtree.h> 6#include <linux/rbtree.h>
7#include "map_groups.h" 7#include "map_groups.h"
8#include "dsos.h" 8#include "dsos.h"
9#include "event.h"
10#include "rwsem.h" 9#include "rwsem.h"
11 10
12struct addr_location; 11struct addr_location;
@@ -252,20 +251,6 @@ int machines__for_each_thread(struct machines *machines,
252 int (*fn)(struct thread *thread, void *p), 251 int (*fn)(struct thread *thread, void *p),
253 void *priv); 252 void *priv);
254 253
255int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
256 struct target *target, struct perf_thread_map *threads,
257 perf_event__handler_t process, bool data_mmap,
258 unsigned int nr_threads_synthesize);
259static inline
260int machine__synthesize_threads(struct machine *machine, struct target *target,
261 struct perf_thread_map *threads, bool data_mmap,
262 unsigned int nr_threads_synthesize)
263{
264 return __machine__synthesize_threads(machine, NULL, target, threads,
265 perf_event__process, data_mmap,
266 nr_threads_synthesize);
267}
268
269pid_t machine__get_current_tid(struct machine *machine, int cpu); 254pid_t machine__get_current_tid(struct machine *machine, int cpu);
270int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid, 255int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
271 pid_t tid); 256 pid_t tid);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 2b583e6adb49..6267613b551d 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -29,6 +29,7 @@
29#include "thread-stack.h" 29#include "thread-stack.h"
30#include "sample-raw.h" 30#include "sample-raw.h"
31#include "stat.h" 31#include "stat.h"
32#include "util/synthetic-events.h"
32#include "util.h" 33#include "util.h"
33#include "ui/progress.h" 34#include "ui/progress.h"
34#include "../perf.h" 35#include "../perf.h"
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index b7aa076ab6fd..b4c9428c18f0 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -138,9 +138,4 @@ int perf_session__deliver_synth_event(struct perf_session *session,
138int perf_event__process_id_index(struct perf_session *session, 138int perf_event__process_id_index(struct perf_session *session,
139 union perf_event *event); 139 union perf_event *event);
140 140
141int 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#endif /* __PERF_SESSION_H */ 141#endif /* __PERF_SESSION_H */
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2e318d95c528..46c8a5027e12 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -12,6 +12,7 @@
12#include "target.h" 12#include "target.h"
13#include "evlist.h" 13#include "evlist.h"
14#include "evsel.h" 14#include "evsel.h"
15#include "util/synthetic-events.h"
15#include "thread_map.h" 16#include "thread_map.h"
16#include <linux/zalloc.h> 17#include <linux/zalloc.h>
17 18
diff --git a/tools/perf/util/synthetic-events.h b/tools/perf/util/synthetic-events.h
new file mode 100644
index 000000000000..baead0cdc381
--- /dev/null
+++ b/tools/perf/util/synthetic-events.h
@@ -0,0 +1,103 @@
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
diff --git a/tools/perf/util/tsc.h b/tools/perf/util/tsc.h
index e0c3af34ac8d..3c5a632ee57c 100644
--- a/tools/perf/util/tsc.h
+++ b/tools/perf/util/tsc.h
@@ -4,13 +4,12 @@
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7#include "event.h"
8
9struct perf_tsc_conversion { 7struct perf_tsc_conversion {
10 u16 time_shift; 8 u16 time_shift;
11 u32 time_mult; 9 u32 time_mult;
12 u64 time_zero; 10 u64 time_zero;
13}; 11};
12
14struct perf_event_mmap_page; 13struct perf_event_mmap_page;
15 14
16int perf_read_tsc_conversion(const struct perf_event_mmap_page *pc, 15int 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);
20u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc); 19u64 tsc_to_perf_time(u64 cyc, struct perf_tsc_conversion *tc);
21u64 rdtsc(void); 20u64 rdtsc(void);
22 21
23struct perf_event_mmap_page; 22#endif // __PERF_TSC_H
24struct perf_tool;
25struct machine;
26
27int perf_event__synth_time_conv(const struct perf_event_mmap_page *pc,
28 struct perf_tool *tool,
29 perf_event__handler_t process,
30 struct machine *machine);
31
32#endif