diff options
author | Ingo Molnar <mingo@kernel.org> | 2019-08-27 04:22:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-08-27 04:22:25 -0400 |
commit | 794b8bedca9341569e1081bc880e7ea209dbca5c (patch) | |
tree | accdfe136daf45dea3ee62567a53ae2bfb0f7fd8 | |
parent | 39152ee51b77851689f9b23fde6f610d13566c39 (diff) | |
parent | 74a1e863eb73dcc9f069b671dfb40650f3832116 (diff) |
Merge tag 'perf-core-for-mingo-5.4-20190826' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
perf report:
Andi Kleen:
- Make --ns time sort key output column wide enough for nanoseconds.
perf script:
Gustavo A. R. Silva:
- Fix memory leaks in list_scripts()
perf tests:
James Clark:
- Fixes hang in zstd compression test by changing the source of random data.
perf trace:
Arnaldo Carvalho de Melo:
- augmented_raw_syscalls.c BPF helper improvements.
Benjamin Peterson:
- Fix off-by-one error in ioctl cmd->string table.
libperf:
Jiri Olsa:
- Move most PERF_RECORD_ structs to perf/event.h.
headers:
Arnaldo Carvalho de Melo:
- Move cacheline related routines to separate source files.
- Move record_opts and other record declarations to separate files.
- Explicitly add some more needed headers here and there.
Souptick Joarder:
- Remove some duplicate include directives.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
69 files changed, 493 insertions, 427 deletions
diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index c73da3245b67..a185dab2d903 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/zalloc.h> | 15 | #include <linux/zalloc.h> |
16 | 16 | ||
17 | #include "cs-etm.h" | 17 | #include "cs-etm.h" |
18 | #include "../../perf.h" | 18 | #include "../../util/record.h" |
19 | #include "../../util/auxtrace.h" | 19 | #include "../../util/auxtrace.h" |
20 | #include "../../util/cpumap.h" | 20 | #include "../../util/cpumap.h" |
21 | #include "../../util/evlist.h" | 21 | #include "../../util/evlist.h" |
diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c index 00915b8fd05b..cdd5c0c84183 100644 --- a/tools/perf/arch/arm64/util/arm-spe.c +++ b/tools/perf/arch/arm64/util/arm-spe.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "../../util/pmu.h" | 19 | #include "../../util/pmu.h" |
20 | #include "../../util/debug.h" | 20 | #include "../../util/debug.h" |
21 | #include "../../util/auxtrace.h" | 21 | #include "../../util/auxtrace.h" |
22 | #include "../../util/record.h" | ||
22 | #include "../../util/arm-spe.h" | 23 | #include "../../util/arm-spe.h" |
23 | 24 | ||
24 | #define KiB(x) ((x) * 1024) | 25 | #define KiB(x) ((x) * 1024) |
diff --git a/tools/perf/arch/s390/util/auxtrace.c b/tools/perf/arch/s390/util/auxtrace.c index cab46f517b83..f32d7a72d039 100644 --- a/tools/perf/arch/s390/util/auxtrace.c +++ b/tools/perf/arch/s390/util/auxtrace.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "../../util/evlist.h" | 8 | #include "../../util/evlist.h" |
9 | #include "../../util/auxtrace.h" | 9 | #include "../../util/auxtrace.h" |
10 | #include "../../util/evsel.h" | 10 | #include "../../util/evsel.h" |
11 | #include "../../util/record.h" | ||
11 | 12 | ||
12 | #define PERF_EVENT_CPUM_SF 0xB0000 /* Event: Basic-sampling */ | 13 | #define PERF_EVENT_CPUM_SF 0xB0000 /* Event: Basic-sampling */ |
13 | #define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */ | 14 | #define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */ |
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 582182d98a7f..02776109ba46 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c | |||
@@ -1,6 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <inttypes.h> | 3 | #include <inttypes.h> |
4 | #include <stdbool.h> | ||
4 | #include <stdio.h> | 5 | #include <stdio.h> |
5 | #include <unistd.h> | 6 | #include <unistd.h> |
6 | #include <linux/types.h> | 7 | #include <linux/types.h> |
@@ -13,6 +14,7 @@ | |||
13 | #include "evsel.h" | 14 | #include "evsel.h" |
14 | #include "thread_map.h" | 15 | #include "thread_map.h" |
15 | #include "cpumap.h" | 16 | #include "cpumap.h" |
17 | #include "record.h" | ||
16 | #include "tsc.h" | 18 | #include "tsc.h" |
17 | #include "tests/tests.h" | 19 | #include "tests/tests.h" |
18 | 20 | ||
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index 2d5d8a12dd1f..1f2cf612bc9c 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "../../util/session.h" | 17 | #include "../../util/session.h" |
18 | #include "../../util/pmu.h" | 18 | #include "../../util/pmu.h" |
19 | #include "../../util/debug.h" | 19 | #include "../../util/debug.h" |
20 | #include "../../util/record.h" | ||
20 | #include "../../util/tsc.h" | 21 | #include "../../util/tsc.h" |
21 | #include "../../util/auxtrace.h" | 22 | #include "../../util/auxtrace.h" |
22 | #include "../../util/intel-bts.h" | 23 | #include "../../util/intel-bts.h" |
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index c72a77a82b39..44cfe72c1a4c 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/zalloc.h> | 13 | #include <linux/zalloc.h> |
14 | #include <cpuid.h> | 14 | #include <cpuid.h> |
15 | 15 | ||
16 | #include "../../perf.h" | ||
17 | #include "../../util/session.h" | 16 | #include "../../util/session.h" |
18 | #include "../../util/event.h" | 17 | #include "../../util/event.h" |
19 | #include "../../util/evlist.h" | 18 | #include "../../util/evlist.h" |
@@ -24,6 +23,8 @@ | |||
24 | #include "../../util/pmu.h" | 23 | #include "../../util/pmu.h" |
25 | #include "../../util/debug.h" | 24 | #include "../../util/debug.h" |
26 | #include "../../util/auxtrace.h" | 25 | #include "../../util/auxtrace.h" |
26 | #include "../../util/record.h" | ||
27 | #include "../../util/target.h" | ||
27 | #include "../../util/tsc.h" | 28 | #include "../../util/tsc.h" |
28 | #include "../../util/intel-pt.h" | 29 | #include "../../util/intel-pt.h" |
29 | 30 | ||
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 211143720078..73782d99ee5a 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "hist.h" | 26 | #include "hist.h" |
27 | #include "sort.h" | 27 | #include "sort.h" |
28 | #include "tool.h" | 28 | #include "tool.h" |
29 | #include "cacheline.h" | ||
29 | #include "data.h" | 30 | #include "data.h" |
30 | #include "event.h" | 31 | #include "event.h" |
31 | #include "evlist.h" | 32 | #include "evlist.h" |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index e91c0d798181..51c37e53b3d8 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "util/session.h" | 15 | #include "util/session.h" |
16 | #include "util/tool.h" | 16 | #include "util/tool.h" |
17 | #include "util/sort.h" | 17 | #include "util/sort.h" |
18 | #include "util/srcline.h" | ||
18 | #include "util/symbol.h" | 19 | #include "util/symbol.h" |
19 | #include "util/data.h" | 20 | #include "util/data.h" |
20 | #include "util/config.h" | 21 | #include "util/config.h" |
@@ -22,6 +23,7 @@ | |||
22 | #include "util/annotate.h" | 23 | #include "util/annotate.h" |
23 | #include "util/map.h" | 24 | #include "util/map.h" |
24 | #include <linux/zalloc.h> | 25 | #include <linux/zalloc.h> |
26 | #include <subcmd/parse-options.h> | ||
25 | 27 | ||
26 | #include <errno.h> | 28 | #include <errno.h> |
27 | #include <inttypes.h> | 29 | #include <inttypes.h> |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f71631f2bcb5..359bb8f33e57 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -8,8 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | #include "builtin.h" | 9 | #include "builtin.h" |
10 | 10 | ||
11 | #include "perf.h" | ||
12 | |||
13 | #include "util/build-id.h" | 11 | #include "util/build-id.h" |
14 | #include <subcmd/parse-options.h> | 12 | #include <subcmd/parse-options.h> |
15 | #include "util/parse-events.h" | 13 | #include "util/parse-events.h" |
@@ -22,9 +20,11 @@ | |||
22 | #include "util/evlist.h" | 20 | #include "util/evlist.h" |
23 | #include "util/evsel.h" | 21 | #include "util/evsel.h" |
24 | #include "util/debug.h" | 22 | #include "util/debug.h" |
23 | #include "util/target.h" | ||
25 | #include "util/session.h" | 24 | #include "util/session.h" |
26 | #include "util/tool.h" | 25 | #include "util/tool.h" |
27 | #include "util/symbol.h" | 26 | #include "util/symbol.h" |
27 | #include "util/record.h" | ||
28 | #include "util/cpumap.h" | 28 | #include "util/cpumap.h" |
29 | #include "util/thread_map.h" | 29 | #include "util/thread_map.h" |
30 | #include "util/data.h" | 30 | #include "util/data.h" |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 79dfb1139f94..318b0b95c14c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "util/evswitch.h" | 28 | #include "util/evswitch.h" |
29 | #include "util/header.h" | 29 | #include "util/header.h" |
30 | #include "util/session.h" | 30 | #include "util/session.h" |
31 | #include "util/srcline.h" | ||
31 | #include "util/tool.h" | 32 | #include "util/tool.h" |
32 | 33 | ||
33 | #include <subcmd/parse-options.h> | 34 | #include <subcmd/parse-options.h> |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 0d6b4c3b1a51..025151dcb651 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -2643,7 +2643,7 @@ static int process_lost(struct perf_tool *tool __maybe_unused, | |||
2643 | 2643 | ||
2644 | timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr)); | 2644 | timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr)); |
2645 | printf("%15s ", tstr); | 2645 | printf("%15s ", tstr); |
2646 | printf("lost %" PRIu64 " events on cpu %d\n", event->lost.lost, sample->cpu); | 2646 | printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); |
2647 | 2647 | ||
2648 | return 0; | 2648 | return 0; |
2649 | } | 2649 | } |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 9b93ddeaeafa..51e7e6d0eee6 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1,7 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include "builtin.h" | 2 | #include "builtin.h" |
3 | 3 | ||
4 | #include "perf.h" | ||
5 | #include "util/cache.h" | 4 | #include "util/cache.h" |
6 | #include "util/counts.h" | 5 | #include "util/counts.h" |
7 | #include "util/debug.h" | 6 | #include "util/debug.h" |
@@ -12,6 +11,7 @@ | |||
12 | #include "util/session.h" | 11 | #include "util/session.h" |
13 | #include "util/tool.h" | 12 | #include "util/tool.h" |
14 | #include "util/map.h" | 13 | #include "util/map.h" |
14 | #include "util/srcline.h" | ||
15 | #include "util/symbol.h" | 15 | #include "util/symbol.h" |
16 | #include "util/thread.h" | 16 | #include "util/thread.h" |
17 | #include "util/trace-event.h" | 17 | #include "util/trace-event.h" |
@@ -51,6 +51,7 @@ | |||
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #include <subcmd/pager.h> | 52 | #include <subcmd/pager.h> |
53 | #include <perf/evlist.h> | 53 | #include <perf/evlist.h> |
54 | #include "util/record.h" | ||
54 | 55 | ||
55 | #include <linux/ctype.h> | 56 | #include <linux/ctype.h> |
56 | 57 | ||
@@ -2491,8 +2492,8 @@ static int __cmd_script(struct perf_script *script) | |||
2491 | script->tool.finished_round = process_finished_round_event; | 2492 | script->tool.finished_round = process_finished_round_event; |
2492 | } | 2493 | } |
2493 | if (script->show_bpf_events) { | 2494 | if (script->show_bpf_events) { |
2494 | script->tool.ksymbol = process_bpf_events; | 2495 | script->tool.ksymbol = process_bpf_events; |
2495 | script->tool.bpf_event = process_bpf_events; | 2496 | script->tool.bpf = process_bpf_events; |
2496 | } | 2497 | } |
2497 | 2498 | ||
2498 | if (perf_script__setup_per_event_dump(script)) { | 2499 | if (perf_script__setup_per_event_dump(script)) { |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8a4f1a7d0cba..6ab13f466827 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -40,7 +40,6 @@ | |||
40 | * Jaswinder Singh Rajput <jaswinder@kernel.org> | 40 | * Jaswinder Singh Rajput <jaswinder@kernel.org> |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include "perf.h" | ||
44 | #include "builtin.h" | 43 | #include "builtin.h" |
45 | #include "util/cgroup.h" | 44 | #include "util/cgroup.h" |
46 | #include <subcmd/parse-options.h> | 45 | #include <subcmd/parse-options.h> |
@@ -62,6 +61,7 @@ | |||
62 | #include "util/tool.h" | 61 | #include "util/tool.h" |
63 | #include "util/string2.h" | 62 | #include "util/string2.h" |
64 | #include "util/metricgroup.h" | 63 | #include "util/metricgroup.h" |
64 | #include "util/target.h" | ||
65 | #include "util/top.h" | 65 | #include "util/top.h" |
66 | #include "asm/bug.h" | 66 | #include "asm/bug.h" |
67 | 67 | ||
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index de126258ca10..8ea62fd2591d 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * http://lwn.net/Articles/415728/ ("Announcing a new utility: 'trace'") | 14 | * http://lwn.net/Articles/415728/ ("Announcing a new utility: 'trace'") |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "util/record.h" | ||
17 | #include <traceevent/event-parse.h> | 18 | #include <traceevent/event-parse.h> |
18 | #include <api/fs/tracing_path.h> | 19 | #include <api/fs/tracing_path.h> |
19 | #include <bpf/bpf.h> | 20 | #include <bpf/bpf.h> |
diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c index 79787cf4fce9..b80437971d80 100644 --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c | |||
@@ -60,7 +60,7 @@ struct syscall_exit_args { | |||
60 | long ret; | 60 | long ret; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | struct augmented_filename { | 63 | struct augmented_arg { |
64 | unsigned int size; | 64 | unsigned int size; |
65 | int err; | 65 | int err; |
66 | char value[PATH_MAX]; | 66 | char value[PATH_MAX]; |
@@ -72,41 +72,52 @@ struct augmented_args_payload { | |||
72 | struct syscall_enter_args args; | 72 | struct syscall_enter_args args; |
73 | union { | 73 | union { |
74 | struct { | 74 | struct { |
75 | struct augmented_filename filename, | 75 | struct augmented_arg arg, arg2; |
76 | filename2; | ||
77 | }; | 76 | }; |
78 | struct sockaddr_storage saddr; | 77 | struct sockaddr_storage saddr; |
79 | }; | 78 | }; |
80 | }; | 79 | }; |
81 | 80 | ||
81 | // We need more tmp space than the BPF stack can give us | ||
82 | bpf_map(augmented_args_tmp, PERCPU_ARRAY, int, struct augmented_args_payload, 1); | 82 | bpf_map(augmented_args_tmp, PERCPU_ARRAY, int, struct augmented_args_payload, 1); |
83 | 83 | ||
84 | static inline struct augmented_args_payload *augmented_args_payload(void) | ||
85 | { | ||
86 | int key = 0; | ||
87 | return bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
88 | } | ||
89 | |||
90 | static inline int augmented__output(void *ctx, struct augmented_args_payload *args, int len) | ||
91 | { | ||
92 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | ||
93 | return perf_event_output(ctx, &__augmented_syscalls__, BPF_F_CURRENT_CPU, args, len); | ||
94 | } | ||
95 | |||
84 | static inline | 96 | static inline |
85 | unsigned int augmented_filename__read(struct augmented_filename *augmented_filename, | 97 | unsigned int augmented_arg__read_str(struct augmented_arg *augmented_arg, const void *arg, unsigned int arg_len) |
86 | const void *filename_arg, unsigned int filename_len) | ||
87 | { | 98 | { |
88 | unsigned int len = sizeof(*augmented_filename); | 99 | unsigned int augmented_len = sizeof(*augmented_arg); |
89 | int size = probe_read_str(&augmented_filename->value, filename_len, filename_arg); | 100 | int string_len = probe_read_str(&augmented_arg->value, arg_len, arg); |
90 | 101 | ||
91 | augmented_filename->size = augmented_filename->err = 0; | 102 | augmented_arg->size = augmented_arg->err = 0; |
92 | /* | 103 | /* |
93 | * probe_read_str may return < 0, e.g. -EFAULT | 104 | * probe_read_str may return < 0, e.g. -EFAULT |
94 | * So we leave that in the augmented_filename->size that userspace will | 105 | * So we leave that in the augmented_arg->size that userspace will |
95 | */ | 106 | */ |
96 | if (size > 0) { | 107 | if (string_len > 0) { |
97 | len -= sizeof(augmented_filename->value) - size; | 108 | augmented_len -= sizeof(augmented_arg->value) - string_len; |
98 | len &= sizeof(augmented_filename->value) - 1; | 109 | augmented_len &= sizeof(augmented_arg->value) - 1; |
99 | augmented_filename->size = size; | 110 | augmented_arg->size = string_len; |
100 | } else { | 111 | } else { |
101 | /* | 112 | /* |
102 | * So that username notice the error while still being able | 113 | * So that username notice the error while still being able |
103 | * to skip this augmented arg record | 114 | * to skip this augmented arg record |
104 | */ | 115 | */ |
105 | augmented_filename->err = size; | 116 | augmented_arg->err = string_len; |
106 | len = offsetof(struct augmented_filename, value); | 117 | augmented_len = offsetof(struct augmented_arg, value); |
107 | } | 118 | } |
108 | 119 | ||
109 | return len; | 120 | return augmented_len; |
110 | } | 121 | } |
111 | 122 | ||
112 | SEC("!raw_syscalls:unaugmented") | 123 | SEC("!raw_syscalls:unaugmented") |
@@ -124,8 +135,7 @@ int syscall_unaugmented(struct syscall_enter_args *args) | |||
124 | SEC("!syscalls:sys_enter_connect") | 135 | SEC("!syscalls:sys_enter_connect") |
125 | int sys_enter_connect(struct syscall_enter_args *args) | 136 | int sys_enter_connect(struct syscall_enter_args *args) |
126 | { | 137 | { |
127 | int key = 0; | 138 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
128 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
129 | const void *sockaddr_arg = (const void *)args->args[1]; | 139 | const void *sockaddr_arg = (const void *)args->args[1]; |
130 | unsigned int socklen = args->args[2]; | 140 | unsigned int socklen = args->args[2]; |
131 | unsigned int len = sizeof(augmented_args->args); | 141 | unsigned int len = sizeof(augmented_args->args); |
@@ -138,15 +148,13 @@ int sys_enter_connect(struct syscall_enter_args *args) | |||
138 | 148 | ||
139 | probe_read(&augmented_args->saddr, socklen, sockaddr_arg); | 149 | probe_read(&augmented_args->saddr, socklen, sockaddr_arg); |
140 | 150 | ||
141 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 151 | return augmented__output(args, augmented_args, len + socklen); |
142 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len + socklen); | ||
143 | } | 152 | } |
144 | 153 | ||
145 | SEC("!syscalls:sys_enter_sendto") | 154 | SEC("!syscalls:sys_enter_sendto") |
146 | int sys_enter_sendto(struct syscall_enter_args *args) | 155 | int sys_enter_sendto(struct syscall_enter_args *args) |
147 | { | 156 | { |
148 | int key = 0; | 157 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
149 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
150 | const void *sockaddr_arg = (const void *)args->args[4]; | 158 | const void *sockaddr_arg = (const void *)args->args[4]; |
151 | unsigned int socklen = args->args[5]; | 159 | unsigned int socklen = args->args[5]; |
152 | unsigned int len = sizeof(augmented_args->args); | 160 | unsigned int len = sizeof(augmented_args->args); |
@@ -159,49 +167,43 @@ int sys_enter_sendto(struct syscall_enter_args *args) | |||
159 | 167 | ||
160 | probe_read(&augmented_args->saddr, socklen, sockaddr_arg); | 168 | probe_read(&augmented_args->saddr, socklen, sockaddr_arg); |
161 | 169 | ||
162 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 170 | return augmented__output(args, augmented_args, len + socklen); |
163 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len + socklen); | ||
164 | } | 171 | } |
165 | 172 | ||
166 | SEC("!syscalls:sys_enter_open") | 173 | SEC("!syscalls:sys_enter_open") |
167 | int sys_enter_open(struct syscall_enter_args *args) | 174 | int sys_enter_open(struct syscall_enter_args *args) |
168 | { | 175 | { |
169 | int key = 0; | 176 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
170 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
171 | const void *filename_arg = (const void *)args->args[0]; | 177 | const void *filename_arg = (const void *)args->args[0]; |
172 | unsigned int len = sizeof(augmented_args->args); | 178 | unsigned int len = sizeof(augmented_args->args); |
173 | 179 | ||
174 | if (augmented_args == NULL) | 180 | if (augmented_args == NULL) |
175 | return 1; /* Failure: don't filter */ | 181 | return 1; /* Failure: don't filter */ |
176 | 182 | ||
177 | len += augmented_filename__read(&augmented_args->filename, filename_arg, sizeof(augmented_args->filename.value)); | 183 | len += augmented_arg__read_str(&augmented_args->arg, filename_arg, sizeof(augmented_args->arg.value)); |
178 | 184 | ||
179 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 185 | return augmented__output(args, augmented_args, len); |
180 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len); | ||
181 | } | 186 | } |
182 | 187 | ||
183 | SEC("!syscalls:sys_enter_openat") | 188 | SEC("!syscalls:sys_enter_openat") |
184 | int sys_enter_openat(struct syscall_enter_args *args) | 189 | int sys_enter_openat(struct syscall_enter_args *args) |
185 | { | 190 | { |
186 | int key = 0; | 191 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
187 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
188 | const void *filename_arg = (const void *)args->args[1]; | 192 | const void *filename_arg = (const void *)args->args[1]; |
189 | unsigned int len = sizeof(augmented_args->args); | 193 | unsigned int len = sizeof(augmented_args->args); |
190 | 194 | ||
191 | if (augmented_args == NULL) | 195 | if (augmented_args == NULL) |
192 | return 1; /* Failure: don't filter */ | 196 | return 1; /* Failure: don't filter */ |
193 | 197 | ||
194 | len += augmented_filename__read(&augmented_args->filename, filename_arg, sizeof(augmented_args->filename.value)); | 198 | len += augmented_arg__read_str(&augmented_args->arg, filename_arg, sizeof(augmented_args->arg.value)); |
195 | 199 | ||
196 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 200 | return augmented__output(args, augmented_args, len); |
197 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len); | ||
198 | } | 201 | } |
199 | 202 | ||
200 | SEC("!syscalls:sys_enter_rename") | 203 | SEC("!syscalls:sys_enter_rename") |
201 | int sys_enter_rename(struct syscall_enter_args *args) | 204 | int sys_enter_rename(struct syscall_enter_args *args) |
202 | { | 205 | { |
203 | int key = 0; | 206 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
204 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
205 | const void *oldpath_arg = (const void *)args->args[0], | 207 | const void *oldpath_arg = (const void *)args->args[0], |
206 | *newpath_arg = (const void *)args->args[1]; | 208 | *newpath_arg = (const void *)args->args[1]; |
207 | unsigned int len = sizeof(augmented_args->args), oldpath_len; | 209 | unsigned int len = sizeof(augmented_args->args), oldpath_len; |
@@ -209,18 +211,16 @@ int sys_enter_rename(struct syscall_enter_args *args) | |||
209 | if (augmented_args == NULL) | 211 | if (augmented_args == NULL) |
210 | return 1; /* Failure: don't filter */ | 212 | return 1; /* Failure: don't filter */ |
211 | 213 | ||
212 | oldpath_len = augmented_filename__read(&augmented_args->filename, oldpath_arg, sizeof(augmented_args->filename.value)); | 214 | oldpath_len = augmented_arg__read_str(&augmented_args->arg, oldpath_arg, sizeof(augmented_args->arg.value)); |
213 | len += oldpath_len + augmented_filename__read((void *)(&augmented_args->filename) + oldpath_len, newpath_arg, sizeof(augmented_args->filename.value)); | 215 | len += oldpath_len + augmented_arg__read_str((void *)(&augmented_args->arg) + oldpath_len, newpath_arg, sizeof(augmented_args->arg.value)); |
214 | 216 | ||
215 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 217 | return augmented__output(args, augmented_args, len); |
216 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len); | ||
217 | } | 218 | } |
218 | 219 | ||
219 | SEC("!syscalls:sys_enter_renameat") | 220 | SEC("!syscalls:sys_enter_renameat") |
220 | int sys_enter_renameat(struct syscall_enter_args *args) | 221 | int sys_enter_renameat(struct syscall_enter_args *args) |
221 | { | 222 | { |
222 | int key = 0; | 223 | struct augmented_args_payload *augmented_args = augmented_args_payload(); |
223 | struct augmented_args_payload *augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
224 | const void *oldpath_arg = (const void *)args->args[1], | 224 | const void *oldpath_arg = (const void *)args->args[1], |
225 | *newpath_arg = (const void *)args->args[3]; | 225 | *newpath_arg = (const void *)args->args[3]; |
226 | unsigned int len = sizeof(augmented_args->args), oldpath_len; | 226 | unsigned int len = sizeof(augmented_args->args), oldpath_len; |
@@ -228,11 +228,10 @@ int sys_enter_renameat(struct syscall_enter_args *args) | |||
228 | if (augmented_args == NULL) | 228 | if (augmented_args == NULL) |
229 | return 1; /* Failure: don't filter */ | 229 | return 1; /* Failure: don't filter */ |
230 | 230 | ||
231 | oldpath_len = augmented_filename__read(&augmented_args->filename, oldpath_arg, sizeof(augmented_args->filename.value)); | 231 | oldpath_len = augmented_arg__read_str(&augmented_args->arg, oldpath_arg, sizeof(augmented_args->arg.value)); |
232 | len += oldpath_len + augmented_filename__read((void *)(&augmented_args->filename) + oldpath_len, newpath_arg, sizeof(augmented_args->filename.value)); | 232 | len += oldpath_len + augmented_arg__read_str((void *)(&augmented_args->arg) + oldpath_len, newpath_arg, sizeof(augmented_args->arg.value)); |
233 | 233 | ||
234 | /* If perf_event_output fails, return non-zero so that it gets recorded unaugmented */ | 234 | return augmented__output(args, augmented_args, len); |
235 | return perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, augmented_args, len); | ||
236 | } | 235 | } |
237 | 236 | ||
238 | SEC("raw_syscalls:sys_enter") | 237 | SEC("raw_syscalls:sys_enter") |
@@ -250,15 +249,14 @@ int sys_enter(struct syscall_enter_args *args) | |||
250 | */ | 249 | */ |
251 | unsigned int len = sizeof(augmented_args->args); | 250 | unsigned int len = sizeof(augmented_args->args); |
252 | struct syscall *syscall; | 251 | struct syscall *syscall; |
253 | int key = 0; | ||
254 | |||
255 | augmented_args = bpf_map_lookup_elem(&augmented_args_tmp, &key); | ||
256 | if (augmented_args == NULL) | ||
257 | return 1; | ||
258 | 252 | ||
259 | if (pid_filter__has(&pids_filtered, getpid())) | 253 | if (pid_filter__has(&pids_filtered, getpid())) |
260 | return 0; | 254 | return 0; |
261 | 255 | ||
256 | augmented_args = augmented_args_payload(); | ||
257 | if (augmented_args == NULL) | ||
258 | return 1; | ||
259 | |||
262 | probe_read(&augmented_args->args, sizeof(augmented_args->args), args); | 260 | probe_read(&augmented_args->args, sizeof(augmented_args->args), args); |
263 | 261 | ||
264 | /* | 262 | /* |
diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h new file mode 100644 index 000000000000..36ad3a4a79e6 --- /dev/null +++ b/tools/perf/lib/include/perf/event.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef __LIBPERF_EVENT_H | ||
3 | #define __LIBPERF_EVENT_H | ||
4 | |||
5 | #include <linux/perf_event.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/limits.h> | ||
8 | #include <linux/bpf.h> | ||
9 | |||
10 | struct perf_record_mmap { | ||
11 | struct perf_event_header header; | ||
12 | __u32 pid, tid; | ||
13 | __u64 start; | ||
14 | __u64 len; | ||
15 | __u64 pgoff; | ||
16 | char filename[PATH_MAX]; | ||
17 | }; | ||
18 | |||
19 | struct perf_record_mmap2 { | ||
20 | struct perf_event_header header; | ||
21 | __u32 pid, tid; | ||
22 | __u64 start; | ||
23 | __u64 len; | ||
24 | __u64 pgoff; | ||
25 | __u32 maj; | ||
26 | __u32 min; | ||
27 | __u64 ino; | ||
28 | __u64 ino_generation; | ||
29 | __u32 prot; | ||
30 | __u32 flags; | ||
31 | char filename[PATH_MAX]; | ||
32 | }; | ||
33 | |||
34 | struct perf_record_comm { | ||
35 | struct perf_event_header header; | ||
36 | __u32 pid, tid; | ||
37 | char comm[16]; | ||
38 | }; | ||
39 | |||
40 | struct perf_record_namespaces { | ||
41 | struct perf_event_header header; | ||
42 | __u32 pid, tid; | ||
43 | __u64 nr_namespaces; | ||
44 | struct perf_ns_link_info link_info[]; | ||
45 | }; | ||
46 | |||
47 | struct perf_record_fork { | ||
48 | struct perf_event_header header; | ||
49 | __u32 pid, ppid; | ||
50 | __u32 tid, ptid; | ||
51 | __u64 time; | ||
52 | }; | ||
53 | |||
54 | struct perf_record_lost { | ||
55 | struct perf_event_header header; | ||
56 | __u64 id; | ||
57 | __u64 lost; | ||
58 | }; | ||
59 | |||
60 | struct perf_record_lost_samples { | ||
61 | struct perf_event_header header; | ||
62 | __u64 lost; | ||
63 | }; | ||
64 | |||
65 | /* | ||
66 | * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID | ||
67 | */ | ||
68 | struct perf_record_read { | ||
69 | struct perf_event_header header; | ||
70 | __u32 pid, tid; | ||
71 | __u64 value; | ||
72 | __u64 time_enabled; | ||
73 | __u64 time_running; | ||
74 | __u64 id; | ||
75 | }; | ||
76 | |||
77 | struct perf_record_throttle { | ||
78 | struct perf_event_header header; | ||
79 | __u64 time; | ||
80 | __u64 id; | ||
81 | __u64 stream_id; | ||
82 | }; | ||
83 | |||
84 | #ifndef KSYM_NAME_LEN | ||
85 | #define KSYM_NAME_LEN 256 | ||
86 | #endif | ||
87 | |||
88 | struct perf_record_ksymbol { | ||
89 | struct perf_event_header header; | ||
90 | __u64 addr; | ||
91 | __u32 len; | ||
92 | __u16 ksym_type; | ||
93 | __u16 flags; | ||
94 | char name[KSYM_NAME_LEN]; | ||
95 | }; | ||
96 | |||
97 | struct perf_record_bpf_event { | ||
98 | struct perf_event_header header; | ||
99 | __u16 type; | ||
100 | __u16 flags; | ||
101 | __u32 id; | ||
102 | |||
103 | /* for bpf_prog types */ | ||
104 | __u8 tag[BPF_TAG_SIZE]; // prog tag | ||
105 | }; | ||
106 | |||
107 | struct perf_record_sample { | ||
108 | struct perf_event_header header; | ||
109 | __u64 array[]; | ||
110 | }; | ||
111 | |||
112 | #endif /* __LIBPERF_EVENT_H */ | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index dc0a7a237887..d9e6b8b957b6 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -35,63 +35,6 @@ extern const char perf_version_string[]; | |||
35 | 35 | ||
36 | void pthread__unblock_sigwinch(void); | 36 | void pthread__unblock_sigwinch(void); |
37 | 37 | ||
38 | #include "util/target.h" | ||
39 | |||
40 | struct record_opts { | ||
41 | struct target target; | ||
42 | bool group; | ||
43 | bool inherit_stat; | ||
44 | bool no_buffering; | ||
45 | bool no_inherit; | ||
46 | bool no_inherit_set; | ||
47 | bool no_samples; | ||
48 | bool raw_samples; | ||
49 | bool sample_address; | ||
50 | bool sample_phys_addr; | ||
51 | bool sample_weight; | ||
52 | bool sample_time; | ||
53 | bool sample_time_set; | ||
54 | bool sample_cpu; | ||
55 | bool period; | ||
56 | bool period_set; | ||
57 | bool running_time; | ||
58 | bool full_auxtrace; | ||
59 | bool auxtrace_snapshot_mode; | ||
60 | bool auxtrace_snapshot_on_exit; | ||
61 | bool record_namespaces; | ||
62 | bool record_switch_events; | ||
63 | bool all_kernel; | ||
64 | bool all_user; | ||
65 | bool kernel_callchains; | ||
66 | bool user_callchains; | ||
67 | bool tail_synthesize; | ||
68 | bool overwrite; | ||
69 | bool ignore_missing_thread; | ||
70 | bool strict_freq; | ||
71 | bool sample_id; | ||
72 | bool no_bpf_event; | ||
73 | unsigned int freq; | ||
74 | unsigned int mmap_pages; | ||
75 | unsigned int auxtrace_mmap_pages; | ||
76 | unsigned int user_freq; | ||
77 | u64 branch_stack; | ||
78 | u64 sample_intr_regs; | ||
79 | u64 sample_user_regs; | ||
80 | u64 default_interval; | ||
81 | u64 user_interval; | ||
82 | size_t auxtrace_snapshot_size; | ||
83 | const char *auxtrace_snapshot_opts; | ||
84 | bool sample_transaction; | ||
85 | unsigned initial_delay; | ||
86 | bool use_clockid; | ||
87 | clockid_t clockid; | ||
88 | u64 clockid_res_ns; | ||
89 | int nr_cblocks; | ||
90 | int affinity; | ||
91 | int mmap_flush; | ||
92 | unsigned int comp_level; | ||
93 | }; | ||
94 | |||
95 | enum perf_affinity { | 38 | enum perf_affinity { |
96 | PERF_AFFINITY_SYS = 0, | 39 | PERF_AFFINITY_SYS = 0, |
97 | PERF_AFFINITY_NODE, | 40 | PERF_AFFINITY_NODE, |
@@ -99,10 +42,5 @@ enum perf_affinity { | |||
99 | PERF_AFFINITY_MAX | 42 | PERF_AFFINITY_MAX |
100 | }; | 43 | }; |
101 | 44 | ||
102 | struct option; | ||
103 | extern const char * const *record_usage; | ||
104 | extern struct option *record_options; | ||
105 | extern int version_verbose; | 45 | extern int version_verbose; |
106 | |||
107 | int record__parse_freq(const struct option *opt, const char *str, int unset); | ||
108 | #endif | 46 | #endif |
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c index 9bdf66139099..b6f27ef9fb02 100644 --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * beginning | 4 | * beginning |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <perf.h> | ||
8 | #include <evlist.h> | 7 | #include <evlist.h> |
9 | #include <sys/prctl.h> | 8 | #include <sys/prctl.h> |
9 | #include "record.h" | ||
10 | #include "tests.h" | 10 | #include "tests.h" |
11 | #include "debug.h" | 11 | #include "debug.h" |
12 | #include <errno.h> | 12 | #include <errno.h> |
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index e16f927f38b6..98642961fc63 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
6 | #include <sys/stat.h> | 6 | #include <sys/stat.h> |
7 | #include <fcntl.h> | 7 | #include <fcntl.h> |
8 | #include <util/record.h> | ||
8 | #include <util/util.h> | 9 | #include <util/util.h> |
9 | #include <util/bpf-loader.h> | 10 | #include <util/bpf-loader.h> |
10 | #include <util/evlist.h> | 11 | #include <util/evlist.h> |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index e45df0736261..fe671b860086 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "map.h" | 20 | #include "map.h" |
21 | #include "symbol.h" | 21 | #include "symbol.h" |
22 | #include "event.h" | 22 | #include "event.h" |
23 | #include "record.h" | ||
23 | #include "thread.h" | 24 | #include "thread.h" |
24 | 25 | ||
25 | #include "tests.h" | 26 | #include "tests.h" |
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index 0ce5ce33bac4..2af6faf1bbd6 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "parse-events.h" | 8 | #include "parse-events.h" |
9 | #include "evlist.h" | 9 | #include "evlist.h" |
10 | #include "evsel.h" | 10 | #include "evsel.h" |
11 | #include "record.h" | ||
11 | #include "thread_map.h" | 12 | #include "thread_map.h" |
12 | #include "cpumap.h" | 13 | #include "cpumap.h" |
13 | #include "tests.h" | 14 | #include "tests.h" |
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index 9c06130d37be..62492106fb5e 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c | |||
@@ -1,12 +1,13 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include <stdbool.h> | ||
2 | #include <linux/err.h> | 3 | #include <linux/err.h> |
3 | #include <sys/types.h> | 4 | #include <sys/types.h> |
4 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
5 | #include <fcntl.h> | 6 | #include <fcntl.h> |
6 | #include "perf.h" | ||
7 | #include "evlist.h" | 7 | #include "evlist.h" |
8 | #include "evsel.h" | 8 | #include "evsel.h" |
9 | #include "thread_map.h" | 9 | #include "thread_map.h" |
10 | #include "record.h" | ||
10 | #include "tests.h" | 11 | #include "tests.h" |
11 | #include "debug.h" | 12 | #include "debug.h" |
12 | #include <errno.h> | 13 | #include <errno.h> |
diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c index 396e40d68922..8284752a60c8 100644 --- a/tools/perf/tests/parse-no-sample-id-all.c +++ b/tools/perf/tests/parse-no-sample-id-all.c | |||
@@ -87,10 +87,10 @@ int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest _ | |||
87 | }, | 87 | }, |
88 | .id = 2, | 88 | .id = 2, |
89 | }; | 89 | }; |
90 | struct mmap_event event3 = { | 90 | struct perf_record_mmap event3 = { |
91 | .header = { | 91 | .header = { |
92 | .type = PERF_RECORD_MMAP, | 92 | .type = PERF_RECORD_MMAP, |
93 | .size = sizeof(struct mmap_event), | 93 | .size = sizeof(struct perf_record_mmap), |
94 | }, | 94 | }, |
95 | }; | 95 | }; |
96 | union perf_event *events[] = { | 96 | union perf_event *events[] = { |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 67b388e92cba..3a205f6f9363 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -7,8 +7,8 @@ | |||
7 | #include <sched.h> | 7 | #include <sched.h> |
8 | #include "evlist.h" | 8 | #include "evlist.h" |
9 | #include "evsel.h" | 9 | #include "evsel.h" |
10 | #include "perf.h" | ||
11 | #include "debug.h" | 10 | #include "debug.h" |
11 | #include "record.h" | ||
12 | #include "tests.h" | 12 | #include "tests.h" |
13 | 13 | ||
14 | static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) | 14 | static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) |
diff --git a/tools/perf/tests/shell/record+zstd_comp_decomp.sh b/tools/perf/tests/shell/record+zstd_comp_decomp.sh index 899604d17b85..63a91ec473bb 100755 --- a/tools/perf/tests/shell/record+zstd_comp_decomp.sh +++ b/tools/perf/tests/shell/record+zstd_comp_decomp.sh | |||
@@ -13,7 +13,7 @@ skip_if_no_z_record() { | |||
13 | collect_z_record() { | 13 | collect_z_record() { |
14 | echo "Collecting compressed record file:" | 14 | echo "Collecting compressed record file:" |
15 | $perf_tool record -o $trace_file -g -z -F 5000 -- \ | 15 | $perf_tool record -o $trace_file -g -z -F 5000 -- \ |
16 | dd count=500 if=/dev/random of=/dev/null | 16 | dd count=500 if=/dev/urandom of=/dev/null |
17 | } | 17 | } |
18 | 18 | ||
19 | check_compressed_stats() { | 19 | check_compressed_stats() { |
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index e3cee69f6ea2..b63f02768724 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "evsel.h" | 13 | #include "evsel.h" |
14 | #include "thread_map.h" | 14 | #include "thread_map.h" |
15 | #include "cpumap.h" | 15 | #include "cpumap.h" |
16 | #include "record.h" | ||
16 | #include "tests.h" | 17 | #include "tests.h" |
17 | 18 | ||
18 | static int spin_sleep(void) | 19 | static int spin_sleep(void) |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 4ca38fd0379a..d79a22e2d8be 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -1,6 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include "evlist.h" | 2 | #include "evlist.h" |
3 | #include "evsel.h" | 3 | #include "evsel.h" |
4 | #include "target.h" | ||
4 | #include "thread_map.h" | 5 | #include "thread_map.h" |
5 | #include "cpumap.h" | 6 | #include "cpumap.h" |
6 | #include "tests.h" | 7 | #include "tests.h" |
diff --git a/tools/perf/trace/beauty/ioctl.c b/tools/perf/trace/beauty/ioctl.c index 52242fa4072b..e19eb6ea361d 100644 --- a/tools/perf/trace/beauty/ioctl.c +++ b/tools/perf/trace/beauty/ioctl.c | |||
@@ -21,7 +21,7 @@ | |||
21 | static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size) | 21 | static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size) |
22 | { | 22 | { |
23 | static const char *ioctl_tty_cmd[] = { | 23 | static const char *ioctl_tty_cmd[] = { |
24 | "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW", | 24 | [_IOC_NR(TCGETS)] = "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW", |
25 | "TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY", | 25 | "TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY", |
26 | "TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ", | 26 | "TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ", |
27 | "TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR", | 27 | "TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR", |
diff --git a/tools/perf/ui/browsers/res_sample.c b/tools/perf/ui/browsers/res_sample.c index 08897bd5eb0f..41a9d8923ec4 100644 --- a/tools/perf/ui/browsers/res_sample.c +++ b/tools/perf/ui/browsers/res_sample.c | |||
@@ -6,6 +6,8 @@ | |||
6 | #include "sort.h" | 6 | #include "sort.h" |
7 | #include "config.h" | 7 | #include "config.h" |
8 | #include "time-utils.h" | 8 | #include "time-utils.h" |
9 | #include "../util.h" | ||
10 | #include "../../util/util.h" | ||
9 | #include <linux/time64.h> | 11 | #include <linux/time64.h> |
10 | #include <linux/zalloc.h> | 12 | #include <linux/zalloc.h> |
11 | 13 | ||
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c index 04f9aff5621e..50e0c03171f2 100644 --- a/tools/perf/ui/browsers/scripts.c +++ b/tools/perf/ui/browsers/scripts.c | |||
@@ -1,5 +1,7 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2 | #include "../../builtin.h" | ||
2 | #include "../../util/sort.h" | 3 | #include "../../util/sort.h" |
4 | #include "../../util/util.h" | ||
3 | #include "../../util/hist.h" | 5 | #include "../../util/hist.h" |
4 | #include "../../util/debug.h" | 6 | #include "../../util/debug.h" |
5 | #include "../../util/symbol.h" | 7 | #include "../../util/symbol.h" |
@@ -131,8 +133,10 @@ static int list_scripts(char *script_name, bool *custom, | |||
131 | int key = ui_browser__input_window("perf script command", | 133 | int key = ui_browser__input_window("perf script command", |
132 | "Enter perf script command line (without perf script prefix)", | 134 | "Enter perf script command line (without perf script prefix)", |
133 | script_args, "", 0); | 135 | script_args, "", 0); |
134 | if (key != K_ENTER) | 136 | if (key != K_ENTER) { |
135 | return -1; | 137 | ret = -1; |
138 | goto out; | ||
139 | } | ||
136 | sprintf(script_name, "%s script %s", perf, script_args); | 140 | sprintf(script_name, "%s script %s", perf, script_args); |
137 | } else if (choice < num + max_std) { | 141 | } else if (choice < num + max_std) { |
138 | strcpy(script_name, paths[choice]); | 142 | strcpy(script_name, paths[choice]); |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index ee7ea6deed21..51ed67548b83 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/string.h> | 3 | #include <linux/string.h> |
4 | 4 | ||
5 | #include "../../util/callchain.h" | 5 | #include "../../util/callchain.h" |
6 | #include "../../util/debug.h" | ||
6 | #include "../../util/hist.h" | 7 | #include "../../util/hist.h" |
7 | #include "../../util/map.h" | 8 | #include "../../util/map.h" |
8 | #include "../../util/map_groups.h" | 9 | #include "../../util/map_groups.h" |
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index b922c8c297ca..2e3856471e61 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build | |||
@@ -1,6 +1,7 @@ | |||
1 | perf-y += annotate.o | 1 | perf-y += annotate.o |
2 | perf-y += block-range.o | 2 | perf-y += block-range.o |
3 | perf-y += build-id.o | 3 | perf-y += build-id.o |
4 | perf-y += cacheline.o | ||
4 | perf-y += config.o | 5 | perf-y += config.o |
5 | perf-y += ctype.o | 6 | perf-y += ctype.o |
6 | perf-y += db-export.o | 7 | perf-y += db-export.o |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index e0518dc4c4d2..3bd1691f0be7 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "cache.h" | 22 | #include "cache.h" |
23 | #include "map.h" | 23 | #include "map.h" |
24 | #include "symbol.h" | 24 | #include "symbol.h" |
25 | #include "srcline.h" | ||
25 | #include "units.h" | 26 | #include "units.h" |
26 | #include "debug.h" | 27 | #include "debug.h" |
27 | #include "annotate.h" | 28 | #include "annotate.h" |
@@ -37,6 +38,7 @@ | |||
37 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
38 | #include <linux/string.h> | 39 | #include <linux/string.h> |
39 | #include <bpf/libbpf.h> | 40 | #include <bpf/libbpf.h> |
41 | #include <subcmd/parse-options.h> | ||
40 | 42 | ||
41 | /* FIXME: For the HE_COLORSET */ | 43 | /* FIXME: For the HE_COLORSET */ |
42 | #include "ui/browser.h" | 44 | #include "ui/browser.h" |
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index 094e6ceb3cf2..12e9b7acbb2c 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/zalloc.h> | 27 | #include <linux/zalloc.h> |
28 | 28 | ||
29 | #include "../perf.h" | ||
30 | #include "evlist.h" | 29 | #include "evlist.h" |
31 | #include "dso.h" | 30 | #include "dso.h" |
32 | #include "map.h" | 31 | #include "map.h" |
@@ -41,6 +40,7 @@ | |||
41 | #include <linux/hash.h> | 40 | #include <linux/hash.h> |
42 | 41 | ||
43 | #include "event.h" | 42 | #include "event.h" |
43 | #include "record.h" | ||
44 | #include "session.h" | 44 | #include "session.h" |
45 | #include "debug.h" | 45 | #include "debug.h" |
46 | #include <subcmd/parse-options.h> | 46 | #include <subcmd/parse-options.h> |
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 5a5dcc6d8f85..2d6d500c9af7 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "session.h" | 14 | #include "session.h" |
15 | #include "map.h" | 15 | #include "map.h" |
16 | #include "evlist.h" | 16 | #include "evlist.h" |
17 | #include "record.h" | ||
17 | 18 | ||
18 | #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) | 19 | #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) |
19 | 20 | ||
@@ -34,7 +35,7 @@ static int machine__process_bpf_event_load(struct machine *machine, | |||
34 | struct bpf_prog_info_linear *info_linear; | 35 | struct bpf_prog_info_linear *info_linear; |
35 | struct bpf_prog_info_node *info_node; | 36 | struct bpf_prog_info_node *info_node; |
36 | struct perf_env *env = machine->env; | 37 | struct perf_env *env = machine->env; |
37 | int id = event->bpf_event.id; | 38 | int id = event->bpf.id; |
38 | unsigned int i; | 39 | unsigned int i; |
39 | 40 | ||
40 | /* perf-record, no need to handle bpf-event */ | 41 | /* perf-record, no need to handle bpf-event */ |
@@ -63,14 +64,13 @@ static int machine__process_bpf_event_load(struct machine *machine, | |||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
66 | int machine__process_bpf_event(struct machine *machine __maybe_unused, | 67 | int machine__process_bpf(struct machine *machine, union perf_event *event, |
67 | union perf_event *event, | 68 | struct perf_sample *sample) |
68 | struct perf_sample *sample __maybe_unused) | ||
69 | { | 69 | { |
70 | if (dump_trace) | 70 | if (dump_trace) |
71 | perf_event__fprintf_bpf_event(event, stdout); | 71 | perf_event__fprintf_bpf(event, stdout); |
72 | 72 | ||
73 | switch (event->bpf_event.type) { | 73 | switch (event->bpf.type) { |
74 | case PERF_BPF_EVENT_PROG_LOAD: | 74 | case PERF_BPF_EVENT_PROG_LOAD: |
75 | return machine__process_bpf_event_load(machine, event, sample); | 75 | return machine__process_bpf_event_load(machine, event, sample); |
76 | 76 | ||
@@ -82,8 +82,7 @@ int machine__process_bpf_event(struct machine *machine __maybe_unused, | |||
82 | */ | 82 | */ |
83 | break; | 83 | break; |
84 | default: | 84 | default: |
85 | pr_debug("unexpected bpf_event type of %d\n", | 85 | pr_debug("unexpected bpf event type of %d\n", event->bpf.type); |
86 | event->bpf_event.type); | ||
87 | break; | 86 | break; |
88 | } | 87 | } |
89 | return 0; | 88 | return 0; |
@@ -160,8 +159,8 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, | |||
160 | union perf_event *event, | 159 | union perf_event *event, |
161 | struct record_opts *opts) | 160 | struct record_opts *opts) |
162 | { | 161 | { |
163 | struct ksymbol_event *ksymbol_event = &event->ksymbol_event; | 162 | struct perf_record_ksymbol *ksymbol_event = &event->ksymbol; |
164 | struct bpf_event *bpf_event = &event->bpf_event; | 163 | struct perf_record_bpf_event *bpf_event = &event->bpf; |
165 | struct bpf_prog_info_linear *info_linear; | 164 | struct bpf_prog_info_linear *info_linear; |
166 | struct perf_tool *tool = session->tool; | 165 | struct perf_tool *tool = session->tool; |
167 | struct bpf_prog_info_node *info_node; | 166 | struct bpf_prog_info_node *info_node; |
@@ -229,10 +228,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, | |||
229 | __u64 *prog_addrs = (__u64 *)(uintptr_t)(info->jited_ksyms); | 228 | __u64 *prog_addrs = (__u64 *)(uintptr_t)(info->jited_ksyms); |
230 | int name_len; | 229 | int name_len; |
231 | 230 | ||
232 | *ksymbol_event = (struct ksymbol_event){ | 231 | *ksymbol_event = (struct perf_record_ksymbol) { |
233 | .header = { | 232 | .header = { |
234 | .type = PERF_RECORD_KSYMBOL, | 233 | .type = PERF_RECORD_KSYMBOL, |
235 | .size = offsetof(struct ksymbol_event, name), | 234 | .size = offsetof(struct perf_record_ksymbol, name), |
236 | }, | 235 | }, |
237 | .addr = prog_addrs[i], | 236 | .addr = prog_addrs[i], |
238 | .len = prog_lens[i], | 237 | .len = prog_lens[i], |
@@ -253,10 +252,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, | |||
253 | 252 | ||
254 | if (!opts->no_bpf_event) { | 253 | if (!opts->no_bpf_event) { |
255 | /* Synthesize PERF_RECORD_BPF_EVENT */ | 254 | /* Synthesize PERF_RECORD_BPF_EVENT */ |
256 | *bpf_event = (struct bpf_event){ | 255 | *bpf_event = (struct perf_record_bpf_event) { |
257 | .header = { | 256 | .header = { |
258 | .type = PERF_RECORD_BPF_EVENT, | 257 | .type = PERF_RECORD_BPF_EVENT, |
259 | .size = sizeof(struct bpf_event), | 258 | .size = sizeof(struct perf_record_bpf_event), |
260 | }, | 259 | }, |
261 | .type = PERF_BPF_EVENT_PROG_LOAD, | 260 | .type = PERF_BPF_EVENT_PROG_LOAD, |
262 | .flags = 0, | 261 | .flags = 0, |
@@ -301,7 +300,7 @@ int perf_event__synthesize_bpf_events(struct perf_session *session, | |||
301 | int err; | 300 | int err; |
302 | int fd; | 301 | int fd; |
303 | 302 | ||
304 | event = malloc(sizeof(event->bpf_event) + KSYM_NAME_LEN + machine->id_hdr_size); | 303 | event = malloc(sizeof(event->bpf) + KSYM_NAME_LEN + machine->id_hdr_size); |
305 | if (!event) | 304 | if (!event) |
306 | return -1; | 305 | return -1; |
307 | while (true) { | 306 | while (true) { |
@@ -398,9 +397,9 @@ static int bpf_event__sb_cb(union perf_event *event, void *data) | |||
398 | if (event->header.type != PERF_RECORD_BPF_EVENT) | 397 | if (event->header.type != PERF_RECORD_BPF_EVENT) |
399 | return -1; | 398 | return -1; |
400 | 399 | ||
401 | switch (event->bpf_event.type) { | 400 | switch (event->bpf.type) { |
402 | case PERF_BPF_EVENT_PROG_LOAD: | 401 | case PERF_BPF_EVENT_PROG_LOAD: |
403 | perf_env__add_bpf_info(env, event->bpf_event.id); | 402 | perf_env__add_bpf_info(env, event->bpf.id); |
404 | 403 | ||
405 | case PERF_BPF_EVENT_PROG_UNLOAD: | 404 | case PERF_BPF_EVENT_PROG_UNLOAD: |
406 | /* | 405 | /* |
@@ -410,8 +409,7 @@ static int bpf_event__sb_cb(union perf_event *event, void *data) | |||
410 | */ | 409 | */ |
411 | break; | 410 | break; |
412 | default: | 411 | default: |
413 | pr_debug("unexpected bpf_event type of %d\n", | 412 | pr_debug("unexpected bpf event type of %d\n", event->bpf.type); |
414 | event->bpf_event.type); | ||
415 | break; | 413 | break; |
416 | } | 414 | } |
417 | 415 | ||
diff --git a/tools/perf/util/bpf-event.h b/tools/perf/util/bpf-event.h index 26ab9239f986..417b78835ea0 100644 --- a/tools/perf/util/bpf-event.h +++ b/tools/perf/util/bpf-event.h | |||
@@ -30,8 +30,8 @@ struct btf_node { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | #ifdef HAVE_LIBBPF_SUPPORT | 32 | #ifdef HAVE_LIBBPF_SUPPORT |
33 | int machine__process_bpf_event(struct machine *machine, union perf_event *event, | 33 | int machine__process_bpf(struct machine *machine, union perf_event *event, |
34 | struct perf_sample *sample); | 34 | struct perf_sample *sample); |
35 | 35 | ||
36 | int perf_event__synthesize_bpf_events(struct perf_session *session, | 36 | int perf_event__synthesize_bpf_events(struct perf_session *session, |
37 | perf_event__handler_t process, | 37 | perf_event__handler_t process, |
@@ -43,9 +43,9 @@ void bpf_event__print_bpf_prog_info(struct bpf_prog_info *info, | |||
43 | struct perf_env *env, | 43 | struct perf_env *env, |
44 | FILE *fp); | 44 | FILE *fp); |
45 | #else | 45 | #else |
46 | static inline int machine__process_bpf_event(struct machine *machine __maybe_unused, | 46 | static inline int machine__process_bpf(struct machine *machine __maybe_unused, |
47 | union perf_event *event __maybe_unused, | 47 | union perf_event *event __maybe_unused, |
48 | struct perf_sample *sample __maybe_unused) | 48 | struct perf_sample *sample __maybe_unused) |
49 | { | 49 | { |
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
diff --git a/tools/perf/util/cacheline.c b/tools/perf/util/cacheline.c new file mode 100644 index 000000000000..9361d3f61f75 --- /dev/null +++ b/tools/perf/util/cacheline.c | |||
@@ -0,0 +1,26 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | #include "cacheline.h" | ||
3 | #include "../perf.h" | ||
4 | #include <unistd.h> | ||
5 | |||
6 | #ifdef _SC_LEVEL1_DCACHE_LINESIZE | ||
7 | #define cache_line_size(cacheline_sizep) *cacheline_sizep = sysconf(_SC_LEVEL1_DCACHE_LINESIZE) | ||
8 | #else | ||
9 | #include <api/fs/fs.h> | ||
10 | #include "debug.h" | ||
11 | static void cache_line_size(int *cacheline_sizep) | ||
12 | { | ||
13 | if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep)) | ||
14 | pr_debug("cannot determine cache line size"); | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | int cacheline_size(void) | ||
19 | { | ||
20 | static int size; | ||
21 | |||
22 | if (!size) | ||
23 | cache_line_size(&size); | ||
24 | |||
25 | return size; | ||
26 | } | ||
diff --git a/tools/perf/util/cacheline.h b/tools/perf/util/cacheline.h new file mode 100644 index 000000000000..dec8c0fb1f4a --- /dev/null +++ b/tools/perf/util/cacheline.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef PERF_CACHELINE_H | ||
3 | #define PERF_CACHELINE_H | ||
4 | |||
5 | #include <linux/compiler.h> | ||
6 | |||
7 | int __pure cacheline_size(void); | ||
8 | |||
9 | static inline u64 cl_address(u64 address) | ||
10 | { | ||
11 | /* return the cacheline of the address */ | ||
12 | return (address & ~(cacheline_size() - 1)); | ||
13 | } | ||
14 | |||
15 | static inline u64 cl_offset(u64 address) | ||
16 | { | ||
17 | /* return the cacheline of the address */ | ||
18 | return (address & (cacheline_size() - 1)); | ||
19 | } | ||
20 | |||
21 | #endif // PERF_CACHELINE_H | ||
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index d077704f9afa..dd6e01000385 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "asm/bug.h" | 21 | #include "asm/bug.h" |
22 | 22 | ||
23 | #include "debug.h" | ||
23 | #include "hist.h" | 24 | #include "hist.h" |
24 | #include "sort.h" | 25 | #include "sort.h" |
25 | #include "machine.h" | 26 | #include "machine.h" |
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h index d0c5bbfd91af..c2519e7ea958 100644 --- a/tools/perf/util/cpumap.h +++ b/tools/perf/util/cpumap.h | |||
@@ -7,8 +7,6 @@ | |||
7 | #include <internal/cpumap.h> | 7 | #include <internal/cpumap.h> |
8 | #include <perf/cpumap.h> | 8 | #include <perf/cpumap.h> |
9 | 9 | ||
10 | #include "perf.h" | ||
11 | |||
12 | struct cpu_map_data; | 10 | struct cpu_map_data; |
13 | 11 | ||
14 | struct perf_cpu_map *perf_cpu_map__empty_new(int nr); | 12 | struct perf_cpu_map *perf_cpu_map__empty_new(int nr); |
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 1d1b97a92c3f..74aafe0df506 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | #include <string.h> | 10 | #include <string.h> |
11 | #include <asm/bug.h> | 11 | #include <asm/bug.h> |
12 | #include <sys/types.h> | ||
13 | #include <dirent.h> | 12 | #include <dirent.h> |
14 | 13 | ||
15 | #include "data.h" | 14 | #include "data.h" |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 332edef8d394..33616ea62a47 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -387,7 +387,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
387 | strcpy(execname, ""); | 387 | strcpy(execname, ""); |
388 | 388 | ||
389 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ | 389 | /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ |
390 | n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %[^\n]\n", | 390 | n = sscanf(bf, "%"PRI_lx64"-%"PRI_lx64" %s %"PRI_lx64" %x:%x %u %[^\n]\n", |
391 | &event->mmap2.start, &event->mmap2.len, prot, | 391 | &event->mmap2.start, &event->mmap2.len, prot, |
392 | &event->mmap2.pgoff, &event->mmap2.maj, | 392 | &event->mmap2.pgoff, &event->mmap2.maj, |
393 | &event->mmap2.min, | 393 | &event->mmap2.min, |
@@ -1343,17 +1343,17 @@ int perf_event__process_ksymbol(struct perf_tool *tool __maybe_unused, | |||
1343 | return machine__process_ksymbol(machine, event, sample); | 1343 | return machine__process_ksymbol(machine, event, sample); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | int perf_event__process_bpf_event(struct perf_tool *tool __maybe_unused, | 1346 | int perf_event__process_bpf(struct perf_tool *tool __maybe_unused, |
1347 | union perf_event *event, | 1347 | union perf_event *event, |
1348 | struct perf_sample *sample __maybe_unused, | 1348 | struct perf_sample *sample, |
1349 | struct machine *machine) | 1349 | struct machine *machine) |
1350 | { | 1350 | { |
1351 | return machine__process_bpf_event(machine, event, sample); | 1351 | return machine__process_bpf(machine, event, sample); |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) | 1354 | size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) |
1355 | { | 1355 | { |
1356 | return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %c %s\n", | 1356 | return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 "]: %c %s\n", |
1357 | event->mmap.pid, event->mmap.tid, event->mmap.start, | 1357 | event->mmap.pid, event->mmap.tid, event->mmap.start, |
1358 | event->mmap.len, event->mmap.pgoff, | 1358 | event->mmap.len, event->mmap.pgoff, |
1359 | (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x', | 1359 | (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x', |
@@ -1362,8 +1362,8 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) | |||
1362 | 1362 | ||
1363 | size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp) | 1363 | size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp) |
1364 | { | 1364 | { |
1365 | return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 | 1365 | return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 |
1366 | " %02x:%02x %"PRIu64" %"PRIu64"]: %c%c%c%c %s\n", | 1366 | " %02x:%02x %"PRI_lu64" %"PRI_lu64"]: %c%c%c%c %s\n", |
1367 | event->mmap2.pid, event->mmap2.tid, event->mmap2.start, | 1367 | event->mmap2.pid, event->mmap2.tid, event->mmap2.start, |
1368 | event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, | 1368 | event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, |
1369 | event->mmap2.min, event->mmap2.ino, | 1369 | event->mmap2.min, event->mmap2.ino, |
@@ -1480,22 +1480,21 @@ size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp) | |||
1480 | 1480 | ||
1481 | static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp) | 1481 | static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp) |
1482 | { | 1482 | { |
1483 | return fprintf(fp, " lost %" PRIu64 "\n", event->lost.lost); | 1483 | return fprintf(fp, " lost %" PRI_lu64 "\n", event->lost.lost); |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp) | 1486 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp) |
1487 | { | 1487 | { |
1488 | return fprintf(fp, " addr %" PRIx64 " len %u type %u flags 0x%x name %s\n", | 1488 | return fprintf(fp, " addr %" PRI_lx64 " len %u type %u flags 0x%x name %s\n", |
1489 | event->ksymbol_event.addr, event->ksymbol_event.len, | 1489 | event->ksymbol.addr, event->ksymbol.len, |
1490 | event->ksymbol_event.ksym_type, | 1490 | event->ksymbol.ksym_type, |
1491 | event->ksymbol_event.flags, event->ksymbol_event.name); | 1491 | event->ksymbol.flags, event->ksymbol.name); |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp) | 1494 | size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp) |
1495 | { | 1495 | { |
1496 | return fprintf(fp, " type %u, flags %u, id %u\n", | 1496 | return fprintf(fp, " type %u, flags %u, id %u\n", |
1497 | event->bpf_event.type, event->bpf_event.flags, | 1497 | event->bpf.type, event->bpf.flags, event->bpf.id); |
1498 | event->bpf_event.id); | ||
1499 | } | 1498 | } |
1500 | 1499 | ||
1501 | size_t perf_event__fprintf(union perf_event *event, FILE *fp) | 1500 | size_t perf_event__fprintf(union perf_event *event, FILE *fp) |
@@ -1537,7 +1536,7 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp) | |||
1537 | ret += perf_event__fprintf_ksymbol(event, fp); | 1536 | ret += perf_event__fprintf_ksymbol(event, fp); |
1538 | break; | 1537 | break; |
1539 | case PERF_RECORD_BPF_EVENT: | 1538 | case PERF_RECORD_BPF_EVENT: |
1540 | ret += perf_event__fprintf_bpf_event(event, fp); | 1539 | ret += perf_event__fprintf_bpf(event, fp); |
1541 | break; | 1540 | break; |
1542 | default: | 1541 | default: |
1543 | ret += fprintf(fp, "\n"); | 1542 | ret += fprintf(fp, "\n"); |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 0e164e8ae28d..429a3fe52d6c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -7,108 +7,26 @@ | |||
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/bpf.h> | 8 | #include <linux/bpf.h> |
9 | #include <linux/perf_event.h> | 9 | #include <linux/perf_event.h> |
10 | #include <perf/event.h> | ||
10 | 11 | ||
11 | #include "../perf.h" | 12 | #include "../perf.h" |
12 | #include "build-id.h" | 13 | #include "build-id.h" |
13 | #include "perf_regs.h" | 14 | #include "perf_regs.h" |
14 | 15 | ||
15 | struct mmap_event { | 16 | #ifdef __LP64__ |
16 | struct perf_event_header header; | ||
17 | u32 pid, tid; | ||
18 | u64 start; | ||
19 | u64 len; | ||
20 | u64 pgoff; | ||
21 | char filename[PATH_MAX]; | ||
22 | }; | ||
23 | |||
24 | struct mmap2_event { | ||
25 | struct perf_event_header header; | ||
26 | u32 pid, tid; | ||
27 | u64 start; | ||
28 | u64 len; | ||
29 | u64 pgoff; | ||
30 | u32 maj; | ||
31 | u32 min; | ||
32 | u64 ino; | ||
33 | u64 ino_generation; | ||
34 | u32 prot; | ||
35 | u32 flags; | ||
36 | char filename[PATH_MAX]; | ||
37 | }; | ||
38 | |||
39 | struct comm_event { | ||
40 | struct perf_event_header header; | ||
41 | u32 pid, tid; | ||
42 | char comm[16]; | ||
43 | }; | ||
44 | |||
45 | struct namespaces_event { | ||
46 | struct perf_event_header header; | ||
47 | u32 pid, tid; | ||
48 | u64 nr_namespaces; | ||
49 | struct perf_ns_link_info link_info[]; | ||
50 | }; | ||
51 | |||
52 | struct fork_event { | ||
53 | struct perf_event_header header; | ||
54 | u32 pid, ppid; | ||
55 | u32 tid, ptid; | ||
56 | u64 time; | ||
57 | }; | ||
58 | |||
59 | struct lost_event { | ||
60 | struct perf_event_header header; | ||
61 | u64 id; | ||
62 | u64 lost; | ||
63 | }; | ||
64 | |||
65 | struct lost_samples_event { | ||
66 | struct perf_event_header header; | ||
67 | u64 lost; | ||
68 | }; | ||
69 | |||
70 | /* | 17 | /* |
71 | * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID | 18 | * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining |
19 | * __u64 as long long unsigned int, and then -Werror=format= kicks in and | ||
20 | * complains of the mismatched types, so use these two special extra PRI | ||
21 | * macros to overcome that. | ||
72 | */ | 22 | */ |
73 | struct read_event { | 23 | #define PRI_lu64 "l" PRIu64 |
74 | struct perf_event_header header; | 24 | #define PRI_lx64 "l" PRIx64 |
75 | u32 pid, tid; | 25 | #else |
76 | u64 value; | 26 | #define PRI_lu64 PRIu64 |
77 | u64 time_enabled; | 27 | #define PRI_lx64 PRIx64 |
78 | u64 time_running; | ||
79 | u64 id; | ||
80 | }; | ||
81 | |||
82 | struct throttle_event { | ||
83 | struct perf_event_header header; | ||
84 | u64 time; | ||
85 | u64 id; | ||
86 | u64 stream_id; | ||
87 | }; | ||
88 | |||
89 | #ifndef KSYM_NAME_LEN | ||
90 | #define KSYM_NAME_LEN 256 | ||
91 | #endif | 28 | #endif |
92 | 29 | ||
93 | struct ksymbol_event { | ||
94 | struct perf_event_header header; | ||
95 | u64 addr; | ||
96 | u32 len; | ||
97 | u16 ksym_type; | ||
98 | u16 flags; | ||
99 | char name[KSYM_NAME_LEN]; | ||
100 | }; | ||
101 | |||
102 | struct bpf_event { | ||
103 | struct perf_event_header header; | ||
104 | u16 type; | ||
105 | u16 flags; | ||
106 | u32 id; | ||
107 | |||
108 | /* for bpf_prog types */ | ||
109 | u8 tag[BPF_TAG_SIZE]; // prog tag | ||
110 | }; | ||
111 | |||
112 | #define PERF_SAMPLE_MASK \ | 30 | #define PERF_SAMPLE_MASK \ |
113 | (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ | 31 | (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ |
114 | PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ | 32 | PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ |
@@ -119,11 +37,6 @@ struct bpf_event { | |||
119 | /* perf sample has 16 bits size limit */ | 37 | /* perf sample has 16 bits size limit */ |
120 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) | 38 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) |
121 | 39 | ||
122 | struct sample_event { | ||
123 | struct perf_event_header header; | ||
124 | u64 array[]; | ||
125 | }; | ||
126 | |||
127 | struct regs_dump { | 40 | struct regs_dump { |
128 | u64 abi; | 41 | u64 abi; |
129 | u64 mask; | 42 | u64 mask; |
@@ -392,18 +305,18 @@ static inline void *perf_synth__raw_data(void *p) | |||
392 | * when possible sends this number in a PERF_RECORD_LOST event. The number of | 305 | * when possible sends this number in a PERF_RECORD_LOST event. The number of |
393 | * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while | 306 | * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while |
394 | * total_lost tells exactly how many events the kernel in fact lost, i.e. it is | 307 | * total_lost tells exactly how many events the kernel in fact lost, i.e. it is |
395 | * the sum of all struct lost_event.lost fields reported. | 308 | * the sum of all struct perf_record_lost.lost fields reported. |
396 | * | 309 | * |
397 | * The kernel discards mixed up samples and sends the number in a | 310 | * The kernel discards mixed up samples and sends the number in a |
398 | * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored | 311 | * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored |
399 | * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells | 312 | * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells |
400 | * exactly how many samples the kernel in fact dropped, i.e. it is the sum of | 313 | * exactly how many samples the kernel in fact dropped, i.e. it is the sum of |
401 | * all struct lost_samples_event.lost fields reported. | 314 | * all struct perf_record_lost_samples.lost fields reported. |
402 | * | 315 | * |
403 | * The total_period is needed because by default auto-freq is used, so | 316 | * The total_period is needed because by default auto-freq is used, so |
404 | * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get | 317 | * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get |
405 | * the total number of low level events, it is necessary to to sum all struct | 318 | * the total number of low level events, it is necessary to to sum all struct |
406 | * sample_event.period and stash the result in total_period. | 319 | * perf_record_sample.period and stash the result in total_period. |
407 | */ | 320 | */ |
408 | struct events_stats { | 321 | struct events_stats { |
409 | u64 total_period; | 322 | u64 total_period; |
@@ -637,16 +550,18 @@ struct compressed_event { | |||
637 | 550 | ||
638 | union perf_event { | 551 | union perf_event { |
639 | struct perf_event_header header; | 552 | struct perf_event_header header; |
640 | struct mmap_event mmap; | 553 | struct perf_record_mmap mmap; |
641 | struct mmap2_event mmap2; | 554 | struct perf_record_mmap2 mmap2; |
642 | struct comm_event comm; | 555 | struct perf_record_comm comm; |
643 | struct namespaces_event namespaces; | 556 | struct perf_record_namespaces namespaces; |
644 | struct fork_event fork; | 557 | struct perf_record_fork fork; |
645 | struct lost_event lost; | 558 | struct perf_record_lost lost; |
646 | struct lost_samples_event lost_samples; | 559 | struct perf_record_lost_samples lost_samples; |
647 | struct read_event read; | 560 | struct perf_record_read read; |
648 | struct throttle_event throttle; | 561 | struct perf_record_throttle throttle; |
649 | struct sample_event sample; | 562 | struct perf_record_sample sample; |
563 | struct perf_record_bpf_event bpf; | ||
564 | struct perf_record_ksymbol ksymbol; | ||
650 | struct attr_event attr; | 565 | struct attr_event attr; |
651 | struct event_update_event event_update; | 566 | struct event_update_event event_update; |
652 | struct event_type_event event_type; | 567 | struct event_type_event event_type; |
@@ -666,8 +581,6 @@ union perf_event { | |||
666 | struct stat_round_event stat_round; | 581 | struct stat_round_event stat_round; |
667 | struct time_conv_event time_conv; | 582 | struct time_conv_event time_conv; |
668 | struct feature_event feat; | 583 | struct feature_event feat; |
669 | struct ksymbol_event ksymbol_event; | ||
670 | struct bpf_event bpf_event; | ||
671 | struct compressed_event pack; | 584 | struct compressed_event pack; |
672 | }; | 585 | }; |
673 | 586 | ||
@@ -770,10 +683,10 @@ int perf_event__process_ksymbol(struct perf_tool *tool, | |||
770 | union perf_event *event, | 683 | union perf_event *event, |
771 | struct perf_sample *sample, | 684 | struct perf_sample *sample, |
772 | struct machine *machine); | 685 | struct machine *machine); |
773 | int perf_event__process_bpf_event(struct perf_tool *tool, | 686 | int perf_event__process_bpf(struct perf_tool *tool, |
774 | union perf_event *event, | 687 | union perf_event *event, |
775 | struct perf_sample *sample, | 688 | struct perf_sample *sample, |
776 | struct machine *machine); | 689 | struct machine *machine); |
777 | int perf_tool__process_synth_event(struct perf_tool *tool, | 690 | int perf_tool__process_synth_event(struct perf_tool *tool, |
778 | union perf_event *event, | 691 | union perf_event *event, |
779 | struct machine *machine, | 692 | struct machine *machine, |
@@ -838,7 +751,7 @@ size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp); | |||
838 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); | 751 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); |
839 | size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); | 752 | size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); |
840 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); | 753 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); |
841 | size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp); | 754 | size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp); |
842 | size_t perf_event__fprintf(union perf_event *event, FILE *fp); | 755 | size_t perf_event__fprintf(union perf_event *event, FILE *fp); |
843 | 756 | ||
844 | int kallsyms__get_function_start(const char *kallsyms_filename, | 757 | int kallsyms__get_function_start(const char *kallsyms_filename, |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index ff415680fe0a..47bc54111f57 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist, | |||
587 | static int perf_evlist__event2id(struct evlist *evlist, | 587 | static int perf_evlist__event2id(struct evlist *evlist, |
588 | union perf_event *event, u64 *id) | 588 | union perf_event *event, u64 *id) |
589 | { | 589 | { |
590 | const u64 *array = event->sample.array; | 590 | const __u64 *array = event->sample.array; |
591 | ssize_t n; | 591 | ssize_t n; |
592 | 592 | ||
593 | n = (event->header.size - sizeof(event->header)) >> 3; | 593 | n = (event->header.size - sizeof(event->header)) >> 3; |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index e983e721beca..fa676355559e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "thread_map.h" | 34 | #include "thread_map.h" |
35 | #include "target.h" | 35 | #include "target.h" |
36 | #include "perf_regs.h" | 36 | #include "perf_regs.h" |
37 | #include "record.h" | ||
37 | #include "debug.h" | 38 | #include "debug.h" |
38 | #include "trace-event.h" | 39 | #include "trace-event.h" |
39 | #include "stat.h" | 40 | #include "stat.h" |
@@ -116,7 +117,7 @@ int __perf_evsel__sample_size(u64 sample_type) | |||
116 | * | 117 | * |
117 | * This function returns the position of the event id (PERF_SAMPLE_ID or | 118 | * This function returns the position of the event id (PERF_SAMPLE_ID or |
118 | * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of struct | 119 | * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of struct |
119 | * sample_event. | 120 | * perf_record_sample. |
120 | */ | 121 | */ |
121 | static int __perf_evsel__calc_id_pos(u64 sample_type) | 122 | static int __perf_evsel__calc_id_pos(u64 sample_type) |
122 | { | 123 | { |
@@ -1071,8 +1072,7 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts, | |||
1071 | attr->mmap2 = track && !perf_missing_features.mmap2; | 1072 | attr->mmap2 = track && !perf_missing_features.mmap2; |
1072 | attr->comm = track; | 1073 | attr->comm = track; |
1073 | attr->ksymbol = track && !perf_missing_features.ksymbol; | 1074 | attr->ksymbol = track && !perf_missing_features.ksymbol; |
1074 | attr->bpf_event = track && !opts->no_bpf_event && | 1075 | attr->bpf_event = track && !opts->no_bpf_event && !perf_missing_features.bpf; |
1075 | !perf_missing_features.bpf_event; | ||
1076 | 1076 | ||
1077 | if (opts->record_namespaces) | 1077 | if (opts->record_namespaces) |
1078 | attr->namespaces = track; | 1078 | attr->namespaces = track; |
@@ -1802,7 +1802,7 @@ fallback_missing_features: | |||
1802 | evsel->core.attr.read_format &= ~(PERF_FORMAT_GROUP|PERF_FORMAT_ID); | 1802 | evsel->core.attr.read_format &= ~(PERF_FORMAT_GROUP|PERF_FORMAT_ID); |
1803 | if (perf_missing_features.ksymbol) | 1803 | if (perf_missing_features.ksymbol) |
1804 | evsel->core.attr.ksymbol = 0; | 1804 | evsel->core.attr.ksymbol = 0; |
1805 | if (perf_missing_features.bpf_event) | 1805 | if (perf_missing_features.bpf) |
1806 | evsel->core.attr.bpf_event = 0; | 1806 | evsel->core.attr.bpf_event = 0; |
1807 | retry_sample_id: | 1807 | retry_sample_id: |
1808 | if (perf_missing_features.sample_id_all) | 1808 | if (perf_missing_features.sample_id_all) |
@@ -1919,8 +1919,8 @@ try_fallback: | |||
1919 | perf_missing_features.aux_output = true; | 1919 | perf_missing_features.aux_output = true; |
1920 | pr_debug2("Kernel has no attr.aux_output support, bailing out\n"); | 1920 | pr_debug2("Kernel has no attr.aux_output support, bailing out\n"); |
1921 | goto out_close; | 1921 | goto out_close; |
1922 | } else if (!perf_missing_features.bpf_event && evsel->core.attr.bpf_event) { | 1922 | } else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) { |
1923 | perf_missing_features.bpf_event = true; | 1923 | perf_missing_features.bpf = true; |
1924 | pr_debug2("switching off bpf_event\n"); | 1924 | pr_debug2("switching off bpf_event\n"); |
1925 | goto fallback_missing_features; | 1925 | goto fallback_missing_features; |
1926 | } else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) { | 1926 | } else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) { |
@@ -2008,7 +2008,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel, | |||
2008 | struct perf_sample *sample) | 2008 | struct perf_sample *sample) |
2009 | { | 2009 | { |
2010 | u64 type = evsel->core.attr.sample_type; | 2010 | u64 type = evsel->core.attr.sample_type; |
2011 | const u64 *array = event->sample.array; | 2011 | const __u64 *array = event->sample.array; |
2012 | bool swapped = evsel->needs_swap; | 2012 | bool swapped = evsel->needs_swap; |
2013 | union u64_swap u; | 2013 | union u64_swap u; |
2014 | 2014 | ||
@@ -2098,7 +2098,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event, | |||
2098 | { | 2098 | { |
2099 | u64 type = evsel->core.attr.sample_type; | 2099 | u64 type = evsel->core.attr.sample_type; |
2100 | bool swapped = evsel->needs_swap; | 2100 | bool swapped = evsel->needs_swap; |
2101 | const u64 *array; | 2101 | const __u64 *array; |
2102 | u16 max_size = event->header.size; | 2102 | u16 max_size = event->header.size; |
2103 | const void *endp = (void *)event + max_size; | 2103 | const void *endp = (void *)event + max_size; |
2104 | u64 sz; | 2104 | u64 sz; |
@@ -2377,7 +2377,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, | |||
2377 | u64 *timestamp) | 2377 | u64 *timestamp) |
2378 | { | 2378 | { |
2379 | u64 type = evsel->core.attr.sample_type; | 2379 | u64 type = evsel->core.attr.sample_type; |
2380 | const u64 *array; | 2380 | const __u64 *array; |
2381 | 2381 | ||
2382 | if (!(type & PERF_SAMPLE_TIME)) | 2382 | if (!(type & PERF_SAMPLE_TIME)) |
2383 | return -1; | 2383 | return -1; |
@@ -2419,7 +2419,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, | |||
2419 | size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, | 2419 | size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, |
2420 | u64 read_format) | 2420 | u64 read_format) |
2421 | { | 2421 | { |
2422 | size_t sz, result = sizeof(struct sample_event); | 2422 | size_t sz, result = sizeof(struct perf_record_sample); |
2423 | 2423 | ||
2424 | if (type & PERF_SAMPLE_IDENTIFIER) | 2424 | if (type & PERF_SAMPLE_IDENTIFIER) |
2425 | result += sizeof(u64); | 2425 | result += sizeof(u64); |
@@ -2528,7 +2528,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, | |||
2528 | u64 read_format, | 2528 | u64 read_format, |
2529 | const struct perf_sample *sample) | 2529 | const struct perf_sample *sample) |
2530 | { | 2530 | { |
2531 | u64 *array; | 2531 | __u64 *array; |
2532 | size_t sz; | 2532 | size_t sz; |
2533 | /* | 2533 | /* |
2534 | * used for cross-endian analysis. See git commit 65014ab3 | 2534 | * used for cross-endian analysis. See git commit 65014ab3 |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 5a351cae66df..fd60caced4fc 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -107,7 +107,7 @@ struct xyarray; | |||
107 | * show the name used, not some alias. | 107 | * show the name used, not some alias. |
108 | * @id_pos: the position of the event id (PERF_SAMPLE_ID or | 108 | * @id_pos: the position of the event id (PERF_SAMPLE_ID or |
109 | * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of | 109 | * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of |
110 | * struct sample_event | 110 | * struct perf_record_sample |
111 | * @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or | 111 | * @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or |
112 | * PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all | 112 | * PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all |
113 | * is used there is an id sample appended to non-sample events | 113 | * is used there is an id sample appended to non-sample events |
@@ -194,7 +194,7 @@ struct perf_missing_features { | |||
194 | bool write_backward; | 194 | bool write_backward; |
195 | bool group_read; | 195 | bool group_read; |
196 | bool ksymbol; | 196 | bool ksymbol; |
197 | bool bpf_event; | 197 | bool bpf; |
198 | bool aux_output; | 198 | bool aux_output; |
199 | }; | 199 | }; |
200 | 200 | ||
diff --git a/tools/perf/util/get_current_dir_name.c b/tools/perf/util/get_current_dir_name.c index 01f32f26552d..b205d929245f 100644 --- a/tools/perf/util/get_current_dir_name.c +++ b/tools/perf/util/get_current_dir_name.c | |||
@@ -5,7 +5,6 @@ | |||
5 | #include "get_current_dir_name.h" | 5 | #include "get_current_dir_name.h" |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <stdlib.h> | ||
9 | 8 | ||
10 | /* Android's 'bionic' library, for one, doesn't have this */ | 9 | /* Android's 'bionic' library, for one, doesn't have this */ |
11 | 10 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 8efbf58dc3d0..33702675073c 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -193,7 +193,10 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) | |||
193 | hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3); | 193 | hists__new_col_len(hists, HISTC_MEM_LVL, 21 + 3); |
194 | hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); | 194 | hists__new_col_len(hists, HISTC_LOCAL_WEIGHT, 12); |
195 | hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); | 195 | hists__new_col_len(hists, HISTC_GLOBAL_WEIGHT, 12); |
196 | hists__new_col_len(hists, HISTC_TIME, 12); | 196 | if (symbol_conf.nanosecs) |
197 | hists__new_col_len(hists, HISTC_TIME, 16); | ||
198 | else | ||
199 | hists__new_col_len(hists, HISTC_TIME, 12); | ||
197 | 200 | ||
198 | if (h->srcline) { | 201 | if (h->srcline) { |
199 | len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header)); | 202 | len = MAX(strlen(h->srcline), strlen(sort_srcline.se_header)); |
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index 7eb9e6dc27dd..8dc6408206b9 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c | |||
@@ -818,7 +818,7 @@ static int intel_bts_synth_events(struct intel_bts *bts, | |||
818 | * We only use sample types from PERF_SAMPLE_MASK so we can use | 818 | * We only use sample types from PERF_SAMPLE_MASK so we can use |
819 | * __perf_evsel__sample_size() here. | 819 | * __perf_evsel__sample_size() here. |
820 | */ | 820 | */ |
821 | bts->branches_event_size = sizeof(struct sample_event) + | 821 | bts->branches_event_size = sizeof(struct perf_record_sample) + |
822 | __perf_evsel__sample_size(attr.sample_type); | 822 | __perf_evsel__sample_size(attr.sample_type); |
823 | } | 823 | } |
824 | 824 | ||
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index a09c495f866b..46913637085b 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h | |||
@@ -2,9 +2,9 @@ | |||
2 | #ifndef __PERF_KVM_STAT_H | 2 | #ifndef __PERF_KVM_STAT_H |
3 | #define __PERF_KVM_STAT_H | 3 | #define __PERF_KVM_STAT_H |
4 | 4 | ||
5 | #include "../perf.h" | ||
6 | #include "tool.h" | 5 | #include "tool.h" |
7 | #include "stat.h" | 6 | #include "stat.h" |
7 | #include "record.h" | ||
8 | 8 | ||
9 | struct evsel; | 9 | struct evsel; |
10 | struct evlist; | 10 | struct evlist; |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 5734460fc89e..93483f1764d3 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -10,10 +10,13 @@ | |||
10 | #include "hist.h" | 10 | #include "hist.h" |
11 | #include "machine.h" | 11 | #include "machine.h" |
12 | #include "map.h" | 12 | #include "map.h" |
13 | #include "srcline.h" | ||
13 | #include "symbol.h" | 14 | #include "symbol.h" |
14 | #include "sort.h" | 15 | #include "sort.h" |
15 | #include "strlist.h" | 16 | #include "strlist.h" |
17 | #include "target.h" | ||
16 | #include "thread.h" | 18 | #include "thread.h" |
19 | #include "util.h" | ||
17 | #include "vdso.h" | 20 | #include "vdso.h" |
18 | #include <stdbool.h> | 21 | #include <stdbool.h> |
19 | #include <sys/types.h> | 22 | #include <sys/types.h> |
@@ -642,7 +645,7 @@ int machine__process_namespaces_event(struct machine *machine __maybe_unused, | |||
642 | int machine__process_lost_event(struct machine *machine __maybe_unused, | 645 | int machine__process_lost_event(struct machine *machine __maybe_unused, |
643 | union perf_event *event, struct perf_sample *sample __maybe_unused) | 646 | union perf_event *event, struct perf_sample *sample __maybe_unused) |
644 | { | 647 | { |
645 | dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", | 648 | dump_printf(": id:%" PRI_lu64 ": lost:%" PRI_lu64 "\n", |
646 | event->lost.id, event->lost.lost); | 649 | event->lost.id, event->lost.lost); |
647 | return 0; | 650 | return 0; |
648 | } | 651 | } |
@@ -650,7 +653,7 @@ int machine__process_lost_event(struct machine *machine __maybe_unused, | |||
650 | int machine__process_lost_samples_event(struct machine *machine __maybe_unused, | 653 | int machine__process_lost_samples_event(struct machine *machine __maybe_unused, |
651 | union perf_event *event, struct perf_sample *sample) | 654 | union perf_event *event, struct perf_sample *sample) |
652 | { | 655 | { |
653 | dump_printf(": id:%" PRIu64 ": lost samples :%" PRIu64 "\n", | 656 | dump_printf(": id:%" PRIu64 ": lost samples :%" PRI_lu64 "\n", |
654 | sample->id, event->lost_samples.lost); | 657 | sample->id, event->lost_samples.lost); |
655 | return 0; | 658 | return 0; |
656 | } | 659 | } |
@@ -710,20 +713,20 @@ static int machine__process_ksymbol_register(struct machine *machine, | |||
710 | struct symbol *sym; | 713 | struct symbol *sym; |
711 | struct map *map; | 714 | struct map *map; |
712 | 715 | ||
713 | map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr); | 716 | map = map_groups__find(&machine->kmaps, event->ksymbol.addr); |
714 | if (!map) { | 717 | if (!map) { |
715 | map = dso__new_map(event->ksymbol_event.name); | 718 | map = dso__new_map(event->ksymbol.name); |
716 | if (!map) | 719 | if (!map) |
717 | return -ENOMEM; | 720 | return -ENOMEM; |
718 | 721 | ||
719 | map->start = event->ksymbol_event.addr; | 722 | map->start = event->ksymbol.addr; |
720 | map->end = map->start + event->ksymbol_event.len; | 723 | map->end = map->start + event->ksymbol.len; |
721 | map_groups__insert(&machine->kmaps, map); | 724 | map_groups__insert(&machine->kmaps, map); |
722 | } | 725 | } |
723 | 726 | ||
724 | sym = symbol__new(map->map_ip(map, map->start), | 727 | sym = symbol__new(map->map_ip(map, map->start), |
725 | event->ksymbol_event.len, | 728 | event->ksymbol.len, |
726 | 0, 0, event->ksymbol_event.name); | 729 | 0, 0, event->ksymbol.name); |
727 | if (!sym) | 730 | if (!sym) |
728 | return -ENOMEM; | 731 | return -ENOMEM; |
729 | dso__insert_symbol(map->dso, sym); | 732 | dso__insert_symbol(map->dso, sym); |
@@ -736,7 +739,7 @@ static int machine__process_ksymbol_unregister(struct machine *machine, | |||
736 | { | 739 | { |
737 | struct map *map; | 740 | struct map *map; |
738 | 741 | ||
739 | map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr); | 742 | map = map_groups__find(&machine->kmaps, event->ksymbol.addr); |
740 | if (map) | 743 | if (map) |
741 | map_groups__remove(&machine->kmaps, map); | 744 | map_groups__remove(&machine->kmaps, map); |
742 | 745 | ||
@@ -750,7 +753,7 @@ int machine__process_ksymbol(struct machine *machine __maybe_unused, | |||
750 | if (dump_trace) | 753 | if (dump_trace) |
751 | perf_event__fprintf_ksymbol(event, stdout); | 754 | perf_event__fprintf_ksymbol(event, stdout); |
752 | 755 | ||
753 | if (event->ksymbol_event.flags & PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER) | 756 | if (event->ksymbol.flags & PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER) |
754 | return machine__process_ksymbol_unregister(machine, event, | 757 | return machine__process_ksymbol_unregister(machine, event, |
755 | sample); | 758 | sample); |
756 | return machine__process_ksymbol_register(machine, event, sample); | 759 | return machine__process_ksymbol_register(machine, event, sample); |
@@ -1919,7 +1922,7 @@ int machine__process_event(struct machine *machine, union perf_event *event, | |||
1919 | case PERF_RECORD_KSYMBOL: | 1922 | case PERF_RECORD_KSYMBOL: |
1920 | ret = machine__process_ksymbol(machine, event, sample); break; | 1923 | ret = machine__process_ksymbol(machine, event, sample); break; |
1921 | case PERF_RECORD_BPF_EVENT: | 1924 | case PERF_RECORD_BPF_EVENT: |
1922 | ret = machine__process_bpf_event(machine, event, sample); break; | 1925 | ret = machine__process_bpf(machine, event, sample); break; |
1923 | default: | 1926 | default: |
1924 | ret = -1; | 1927 | ret = -1; |
1925 | break; | 1928 | break; |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 8b9d7157276d..7d69119d0b5d 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -14,6 +14,7 @@ struct branch_stack; | |||
14 | struct evsel; | 14 | struct evsel; |
15 | struct perf_sample; | 15 | struct perf_sample; |
16 | struct symbol; | 16 | struct symbol; |
17 | struct target; | ||
17 | struct thread; | 18 | struct thread; |
18 | union perf_event; | 19 | union perf_event; |
19 | 20 | ||
diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c index 46d3a7754897..99be15dd2b6b 100644 --- a/tools/perf/util/namespaces.c +++ b/tools/perf/util/namespaces.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/bug.h> | 19 | #include <asm/bug.h> |
20 | #include <linux/zalloc.h> | 20 | #include <linux/zalloc.h> |
21 | 21 | ||
22 | struct namespaces *namespaces__new(struct namespaces_event *event) | 22 | struct namespaces *namespaces__new(struct perf_record_namespaces *event) |
23 | { | 23 | { |
24 | struct namespaces *namespaces; | 24 | struct namespaces *namespaces; |
25 | u64 link_info_size = ((event ? event->nr_namespaces : NR_NAMESPACES) * | 25 | u64 link_info_size = ((event ? event->nr_namespaces : NR_NAMESPACES) * |
diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h index 004430c0de93..40edef56cb52 100644 --- a/tools/perf/util/namespaces.h +++ b/tools/perf/util/namespaces.h | |||
@@ -17,7 +17,7 @@ | |||
17 | int setns(int fd, int nstype); | 17 | int setns(int fd, int nstype); |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | struct namespaces_event; | 20 | struct perf_record_namespaces; |
21 | 21 | ||
22 | struct namespaces { | 22 | struct namespaces { |
23 | struct list_head list; | 23 | struct list_head list; |
@@ -25,7 +25,7 @@ struct namespaces { | |||
25 | struct perf_ns_link_info link_info[]; | 25 | struct perf_ns_link_info link_info[]; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | struct namespaces *namespaces__new(struct namespaces_event *event); | 28 | struct namespaces *namespaces__new(struct perf_record_namespaces *event); |
29 | void namespaces__free(struct namespaces *namespaces); | 29 | void namespaces__free(struct namespaces *namespaces); |
30 | 30 | ||
31 | struct nsinfo { | 31 | struct nsinfo { |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 75ecc32a4427..59974e901232 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -116,12 +116,12 @@ static PyMemberDef pyrf_mmap_event__members[] = { | |||
116 | sample_members | 116 | sample_members |
117 | member_def(perf_event_header, type, T_UINT, "event type"), | 117 | member_def(perf_event_header, type, T_UINT, "event type"), |
118 | member_def(perf_event_header, misc, T_UINT, "event misc"), | 118 | member_def(perf_event_header, misc, T_UINT, "event misc"), |
119 | member_def(mmap_event, pid, T_UINT, "event pid"), | 119 | member_def(perf_record_mmap, pid, T_UINT, "event pid"), |
120 | member_def(mmap_event, tid, T_UINT, "event tid"), | 120 | member_def(perf_record_mmap, tid, T_UINT, "event tid"), |
121 | member_def(mmap_event, start, T_ULONGLONG, "start of the map"), | 121 | member_def(perf_record_mmap, start, T_ULONGLONG, "start of the map"), |
122 | member_def(mmap_event, len, T_ULONGLONG, "map length"), | 122 | member_def(perf_record_mmap, len, T_ULONGLONG, "map length"), |
123 | member_def(mmap_event, pgoff, T_ULONGLONG, "page offset"), | 123 | member_def(perf_record_mmap, pgoff, T_ULONGLONG, "page offset"), |
124 | member_def(mmap_event, filename, T_STRING_INPLACE, "backing store"), | 124 | member_def(perf_record_mmap, filename, T_STRING_INPLACE, "backing store"), |
125 | { .name = NULL, }, | 125 | { .name = NULL, }, |
126 | }; | 126 | }; |
127 | 127 | ||
@@ -130,8 +130,8 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent) | |||
130 | PyObject *ret; | 130 | PyObject *ret; |
131 | char *s; | 131 | char *s; |
132 | 132 | ||
133 | if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRIx64 ", " | 133 | if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRI_lx64 ", " |
134 | "length: %#" PRIx64 ", offset: %#" PRIx64 ", " | 134 | "length: %#" PRI_lx64 ", offset: %#" PRI_lx64 ", " |
135 | "filename: %s }", | 135 | "filename: %s }", |
136 | pevent->event.mmap.pid, pevent->event.mmap.tid, | 136 | pevent->event.mmap.pid, pevent->event.mmap.tid, |
137 | pevent->event.mmap.start, pevent->event.mmap.len, | 137 | pevent->event.mmap.start, pevent->event.mmap.len, |
@@ -159,18 +159,18 @@ static char pyrf_task_event__doc[] = PyDoc_STR("perf task (fork/exit) event obje | |||
159 | static PyMemberDef pyrf_task_event__members[] = { | 159 | static PyMemberDef pyrf_task_event__members[] = { |
160 | sample_members | 160 | sample_members |
161 | member_def(perf_event_header, type, T_UINT, "event type"), | 161 | member_def(perf_event_header, type, T_UINT, "event type"), |
162 | member_def(fork_event, pid, T_UINT, "event pid"), | 162 | member_def(perf_record_fork, pid, T_UINT, "event pid"), |
163 | member_def(fork_event, ppid, T_UINT, "event ppid"), | 163 | member_def(perf_record_fork, ppid, T_UINT, "event ppid"), |
164 | member_def(fork_event, tid, T_UINT, "event tid"), | 164 | member_def(perf_record_fork, tid, T_UINT, "event tid"), |
165 | member_def(fork_event, ptid, T_UINT, "event ptid"), | 165 | member_def(perf_record_fork, ptid, T_UINT, "event ptid"), |
166 | member_def(fork_event, time, T_ULONGLONG, "timestamp"), | 166 | member_def(perf_record_fork, time, T_ULONGLONG, "timestamp"), |
167 | { .name = NULL, }, | 167 | { .name = NULL, }, |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent) | 170 | static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent) |
171 | { | 171 | { |
172 | return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " | 172 | return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " |
173 | "ptid: %u, time: %" PRIu64 "}", | 173 | "ptid: %u, time: %" PRI_lu64 "}", |
174 | pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit", | 174 | pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit", |
175 | pevent->event.fork.pid, | 175 | pevent->event.fork.pid, |
176 | pevent->event.fork.ppid, | 176 | pevent->event.fork.ppid, |
@@ -194,9 +194,9 @@ static char pyrf_comm_event__doc[] = PyDoc_STR("perf comm event object."); | |||
194 | static PyMemberDef pyrf_comm_event__members[] = { | 194 | static PyMemberDef pyrf_comm_event__members[] = { |
195 | sample_members | 195 | sample_members |
196 | member_def(perf_event_header, type, T_UINT, "event type"), | 196 | member_def(perf_event_header, type, T_UINT, "event type"), |
197 | member_def(comm_event, pid, T_UINT, "event pid"), | 197 | member_def(perf_record_comm, pid, T_UINT, "event pid"), |
198 | member_def(comm_event, tid, T_UINT, "event tid"), | 198 | member_def(perf_record_comm, tid, T_UINT, "event tid"), |
199 | member_def(comm_event, comm, T_STRING_INPLACE, "process name"), | 199 | member_def(perf_record_comm, comm, T_STRING_INPLACE, "process name"), |
200 | { .name = NULL, }, | 200 | { .name = NULL, }, |
201 | }; | 201 | }; |
202 | 202 | ||
@@ -223,18 +223,18 @@ static char pyrf_throttle_event__doc[] = PyDoc_STR("perf throttle event object." | |||
223 | static PyMemberDef pyrf_throttle_event__members[] = { | 223 | static PyMemberDef pyrf_throttle_event__members[] = { |
224 | sample_members | 224 | sample_members |
225 | member_def(perf_event_header, type, T_UINT, "event type"), | 225 | member_def(perf_event_header, type, T_UINT, "event type"), |
226 | member_def(throttle_event, time, T_ULONGLONG, "timestamp"), | 226 | member_def(perf_record_throttle, time, T_ULONGLONG, "timestamp"), |
227 | member_def(throttle_event, id, T_ULONGLONG, "event id"), | 227 | member_def(perf_record_throttle, id, T_ULONGLONG, "event id"), |
228 | member_def(throttle_event, stream_id, T_ULONGLONG, "event stream id"), | 228 | member_def(perf_record_throttle, stream_id, T_ULONGLONG, "event stream id"), |
229 | { .name = NULL, }, | 229 | { .name = NULL, }, |
230 | }; | 230 | }; |
231 | 231 | ||
232 | static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) | 232 | static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) |
233 | { | 233 | { |
234 | struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1); | 234 | struct perf_record_throttle *te = (struct perf_record_throttle *)(&pevent->event.header + 1); |
235 | 235 | ||
236 | return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 | 236 | return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRI_lu64 ", id: %" PRI_lu64 |
237 | ", stream_id: %" PRIu64 " }", | 237 | ", stream_id: %" PRI_lu64 " }", |
238 | pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un", | 238 | pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un", |
239 | te->time, te->id, te->stream_id); | 239 | te->time, te->id, te->stream_id); |
240 | } | 240 | } |
@@ -253,8 +253,8 @@ static char pyrf_lost_event__doc[] = PyDoc_STR("perf lost event object."); | |||
253 | 253 | ||
254 | static PyMemberDef pyrf_lost_event__members[] = { | 254 | static PyMemberDef pyrf_lost_event__members[] = { |
255 | sample_members | 255 | sample_members |
256 | member_def(lost_event, id, T_ULONGLONG, "event id"), | 256 | member_def(perf_record_lost, id, T_ULONGLONG, "event id"), |
257 | member_def(lost_event, lost, T_ULONGLONG, "number of lost events"), | 257 | member_def(perf_record_lost, lost, T_ULONGLONG, "number of lost events"), |
258 | { .name = NULL, }, | 258 | { .name = NULL, }, |
259 | }; | 259 | }; |
260 | 260 | ||
@@ -263,8 +263,8 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent) | |||
263 | PyObject *ret; | 263 | PyObject *ret; |
264 | char *s; | 264 | char *s; |
265 | 265 | ||
266 | if (asprintf(&s, "{ type: lost, id: %#" PRIx64 ", " | 266 | if (asprintf(&s, "{ type: lost, id: %#" PRI_lx64 ", " |
267 | "lost: %#" PRIx64 " }", | 267 | "lost: %#" PRI_lx64 " }", |
268 | pevent->event.lost.id, pevent->event.lost.lost) < 0) { | 268 | pevent->event.lost.id, pevent->event.lost.lost) < 0) { |
269 | ret = PyErr_NoMemory(); | 269 | ret = PyErr_NoMemory(); |
270 | } else { | 270 | } else { |
@@ -288,8 +288,8 @@ static char pyrf_read_event__doc[] = PyDoc_STR("perf read event object."); | |||
288 | 288 | ||
289 | static PyMemberDef pyrf_read_event__members[] = { | 289 | static PyMemberDef pyrf_read_event__members[] = { |
290 | sample_members | 290 | sample_members |
291 | member_def(read_event, pid, T_UINT, "event pid"), | 291 | member_def(perf_record_read, pid, T_UINT, "event pid"), |
292 | member_def(read_event, tid, T_UINT, "event tid"), | 292 | member_def(perf_record_read, tid, T_UINT, "event tid"), |
293 | { .name = NULL, }, | 293 | { .name = NULL, }, |
294 | }; | 294 | }; |
295 | 295 | ||
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 51bbd0714e6d..574507d46c98 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <perf/cpumap.h> | 9 | #include <perf/cpumap.h> |
10 | #include "util.h" | 10 | #include "util.h" |
11 | #include "cloexec.h" | 11 | #include "cloexec.h" |
12 | #include "record.h" | ||
12 | 13 | ||
13 | typedef void (*setup_probe_fn_t)(struct evsel *evsel); | 14 | typedef void (*setup_probe_fn_t)(struct evsel *evsel); |
14 | 15 | ||
diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h new file mode 100644 index 000000000000..00275afc524d --- /dev/null +++ b/tools/perf/util/record.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _PERF_RECORD_H | ||
3 | #define _PERF_RECORD_H | ||
4 | |||
5 | #include <time.h> | ||
6 | #include <stdbool.h> | ||
7 | #include <linux/types.h> | ||
8 | #include <linux/stddef.h> | ||
9 | #include <linux/perf_event.h> | ||
10 | #include "util/target.h" | ||
11 | |||
12 | struct option; | ||
13 | |||
14 | struct record_opts { | ||
15 | struct target target; | ||
16 | bool group; | ||
17 | bool inherit_stat; | ||
18 | bool no_buffering; | ||
19 | bool no_inherit; | ||
20 | bool no_inherit_set; | ||
21 | bool no_samples; | ||
22 | bool raw_samples; | ||
23 | bool sample_address; | ||
24 | bool sample_phys_addr; | ||
25 | bool sample_weight; | ||
26 | bool sample_time; | ||
27 | bool sample_time_set; | ||
28 | bool sample_cpu; | ||
29 | bool period; | ||
30 | bool period_set; | ||
31 | bool running_time; | ||
32 | bool full_auxtrace; | ||
33 | bool auxtrace_snapshot_mode; | ||
34 | bool auxtrace_snapshot_on_exit; | ||
35 | bool record_namespaces; | ||
36 | bool record_switch_events; | ||
37 | bool all_kernel; | ||
38 | bool all_user; | ||
39 | bool kernel_callchains; | ||
40 | bool user_callchains; | ||
41 | bool tail_synthesize; | ||
42 | bool overwrite; | ||
43 | bool ignore_missing_thread; | ||
44 | bool strict_freq; | ||
45 | bool sample_id; | ||
46 | bool no_bpf_event; | ||
47 | unsigned int freq; | ||
48 | unsigned int mmap_pages; | ||
49 | unsigned int auxtrace_mmap_pages; | ||
50 | unsigned int user_freq; | ||
51 | u64 branch_stack; | ||
52 | u64 sample_intr_regs; | ||
53 | u64 sample_user_regs; | ||
54 | u64 default_interval; | ||
55 | u64 user_interval; | ||
56 | size_t auxtrace_snapshot_size; | ||
57 | const char *auxtrace_snapshot_opts; | ||
58 | bool sample_transaction; | ||
59 | unsigned initial_delay; | ||
60 | bool use_clockid; | ||
61 | clockid_t clockid; | ||
62 | u64 clockid_res_ns; | ||
63 | int nr_cblocks; | ||
64 | int affinity; | ||
65 | int mmap_flush; | ||
66 | unsigned int comp_level; | ||
67 | }; | ||
68 | |||
69 | extern const char * const *record_usage; | ||
70 | extern struct option *record_options; | ||
71 | |||
72 | int record__parse_freq(const struct option *opt, const char *str, int unset); | ||
73 | |||
74 | #endif // _PERF_RECORD_H | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 82e0438a9160..5786e9c807c5 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -473,8 +473,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) | |||
473 | tool->context_switch = perf_event__process_switch; | 473 | tool->context_switch = perf_event__process_switch; |
474 | if (tool->ksymbol == NULL) | 474 | if (tool->ksymbol == NULL) |
475 | tool->ksymbol = perf_event__process_ksymbol; | 475 | tool->ksymbol = perf_event__process_ksymbol; |
476 | if (tool->bpf_event == NULL) | 476 | if (tool->bpf == NULL) |
477 | tool->bpf_event = perf_event__process_bpf_event; | 477 | tool->bpf = perf_event__process_bpf; |
478 | if (tool->read == NULL) | 478 | if (tool->read == NULL) |
479 | tool->read = process_event_sample_stub; | 479 | tool->read = process_event_sample_stub; |
480 | if (tool->throttle == NULL) | 480 | if (tool->throttle == NULL) |
@@ -1254,13 +1254,13 @@ static void dump_sample(struct evsel *evsel, union perf_event *event, | |||
1254 | 1254 | ||
1255 | static void dump_read(struct evsel *evsel, union perf_event *event) | 1255 | static void dump_read(struct evsel *evsel, union perf_event *event) |
1256 | { | 1256 | { |
1257 | struct read_event *read_event = &event->read; | 1257 | struct perf_record_read *read_event = &event->read; |
1258 | u64 read_format; | 1258 | u64 read_format; |
1259 | 1259 | ||
1260 | if (!dump_trace) | 1260 | if (!dump_trace) |
1261 | return; | 1261 | return; |
1262 | 1262 | ||
1263 | printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, | 1263 | printf(": %d %d %s %" PRI_lu64 "\n", event->read.pid, event->read.tid, |
1264 | perf_evsel__name(evsel), | 1264 | perf_evsel__name(evsel), |
1265 | event->read.value); | 1265 | event->read.value); |
1266 | 1266 | ||
@@ -1270,13 +1270,13 @@ static void dump_read(struct evsel *evsel, union perf_event *event) | |||
1270 | read_format = evsel->core.attr.read_format; | 1270 | read_format = evsel->core.attr.read_format; |
1271 | 1271 | ||
1272 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | 1272 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) |
1273 | printf("... time enabled : %" PRIu64 "\n", read_event->time_enabled); | 1273 | printf("... time enabled : %" PRI_lu64 "\n", read_event->time_enabled); |
1274 | 1274 | ||
1275 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | 1275 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) |
1276 | printf("... time running : %" PRIu64 "\n", read_event->time_running); | 1276 | printf("... time running : %" PRI_lu64 "\n", read_event->time_running); |
1277 | 1277 | ||
1278 | if (read_format & PERF_FORMAT_ID) | 1278 | if (read_format & PERF_FORMAT_ID) |
1279 | printf("... id : %" PRIu64 "\n", read_event->id); | 1279 | printf("... id : %" PRI_lu64 "\n", read_event->id); |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | static struct machine *machines__find_for_cpumode(struct machines *machines, | 1282 | static struct machine *machines__find_for_cpumode(struct machines *machines, |
@@ -1452,7 +1452,7 @@ static int machines__deliver_event(struct machines *machines, | |||
1452 | case PERF_RECORD_KSYMBOL: | 1452 | case PERF_RECORD_KSYMBOL: |
1453 | return tool->ksymbol(tool, event, sample, machine); | 1453 | return tool->ksymbol(tool, event, sample, machine); |
1454 | case PERF_RECORD_BPF_EVENT: | 1454 | case PERF_RECORD_BPF_EVENT: |
1455 | return tool->bpf_event(tool, event, sample, machine); | 1455 | return tool->bpf(tool, event, sample, machine); |
1456 | default: | 1456 | default: |
1457 | ++evlist->stats.nr_unknown_events; | 1457 | ++evlist->stats.nr_unknown_events; |
1458 | return -1; | 1458 | return -1; |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index f9a38a1dd4d1..83eb3fa6f941 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -6,12 +6,14 @@ | |||
6 | #include <linux/time64.h> | 6 | #include <linux/time64.h> |
7 | #include "sort.h" | 7 | #include "sort.h" |
8 | #include "hist.h" | 8 | #include "hist.h" |
9 | #include "cacheline.h" | ||
9 | #include "comm.h" | 10 | #include "comm.h" |
10 | #include "map.h" | 11 | #include "map.h" |
11 | #include "symbol.h" | 12 | #include "symbol.h" |
12 | #include "thread.h" | 13 | #include "thread.h" |
13 | #include "evsel.h" | 14 | #include "evsel.h" |
14 | #include "evlist.h" | 15 | #include "evlist.h" |
16 | #include "srcline.h" | ||
15 | #include "strlist.h" | 17 | #include "strlist.h" |
16 | #include "strbuf.h" | 18 | #include "strbuf.h" |
17 | #include <traceevent/event-parse.h> | 19 | #include <traceevent/event-parse.h> |
@@ -668,17 +670,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right) | |||
668 | static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, | 670 | static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, |
669 | size_t size, unsigned int width) | 671 | size_t size, unsigned int width) |
670 | { | 672 | { |
671 | unsigned long secs; | ||
672 | unsigned long long nsecs; | ||
673 | char he_time[32]; | 673 | char he_time[32]; |
674 | 674 | ||
675 | nsecs = he->time; | ||
676 | secs = nsecs / NSEC_PER_SEC; | ||
677 | nsecs -= secs * NSEC_PER_SEC; | ||
678 | |||
679 | if (symbol_conf.nanosecs) | 675 | if (symbol_conf.nanosecs) |
680 | snprintf(he_time, sizeof he_time, "%5lu.%09llu: ", | 676 | timestamp__scnprintf_nsec(he->time, he_time, |
681 | secs, nsecs); | 677 | sizeof(he_time)); |
682 | else | 678 | else |
683 | timestamp__scnprintf_usec(he->time, he_time, | 679 | timestamp__scnprintf_usec(he->time, he_time, |
684 | sizeof(he_time)); | 680 | sizeof(he_time)); |
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 5e34676a98e8..3d7cef73924c 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h | |||
@@ -1,29 +1,18 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef __PERF_SORT_H | 2 | #ifndef __PERF_SORT_H |
3 | #define __PERF_SORT_H | 3 | #define __PERF_SORT_H |
4 | #include "../builtin.h" | ||
5 | |||
6 | #include <regex.h> | 4 | #include <regex.h> |
7 | 5 | #include <stdbool.h> | |
8 | #include "color.h" | ||
9 | #include <linux/list.h> | 6 | #include <linux/list.h> |
10 | #include "cache.h" | ||
11 | #include <linux/rbtree.h> | 7 | #include <linux/rbtree.h> |
12 | #include "map_symbol.h" | 8 | #include "map_symbol.h" |
13 | #include "symbol_conf.h" | 9 | #include "symbol_conf.h" |
14 | #include "string.h" | ||
15 | #include "callchain.h" | 10 | #include "callchain.h" |
16 | #include "values.h" | 11 | #include "values.h" |
17 | 12 | ||
18 | #include "../perf.h" | ||
19 | #include "debug.h" | ||
20 | #include "header.h" | ||
21 | |||
22 | #include <subcmd/parse-options.h> | ||
23 | #include "parse-events.h" | ||
24 | #include "hist.h" | 13 | #include "hist.h" |
25 | #include "srcline.h" | ||
26 | 14 | ||
15 | struct option; | ||
27 | struct thread; | 16 | struct thread; |
28 | 17 | ||
29 | extern regex_t parent_regex; | 18 | extern regex_t parent_regex; |
@@ -204,18 +193,6 @@ static inline float hist_entry__get_percent_limit(struct hist_entry *he) | |||
204 | return period * 100.0 / total_period; | 193 | return period * 100.0 / total_period; |
205 | } | 194 | } |
206 | 195 | ||
207 | static inline u64 cl_address(u64 address) | ||
208 | { | ||
209 | /* return the cacheline of the address */ | ||
210 | return (address & ~(cacheline_size() - 1)); | ||
211 | } | ||
212 | |||
213 | static inline u64 cl_offset(u64 address) | ||
214 | { | ||
215 | /* return the cacheline of the address */ | ||
216 | return (address & (cacheline_size() - 1)); | ||
217 | } | ||
218 | |||
219 | enum sort_mode { | 196 | enum sort_mode { |
220 | SORT_MODE__NORMAL, | 197 | SORT_MODE__NORMAL, |
221 | SORT_MODE__BRANCH, | 198 | SORT_MODE__BRANCH, |
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 51d6781aa90d..1461dac2322d 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include "string2.h" | 14 | #include "string2.h" |
15 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
16 | #include "cgroup.h" | 16 | #include "cgroup.h" |
17 | #include <math.h> | ||
18 | #include <api/fs/fs.h> | 17 | #include <api/fs/fs.h> |
19 | 18 | ||
20 | #define CNTR_NOT_SUPPORTED "<not supported>" | 19 | #define CNTR_NOT_SUPPORTED "<not supported>" |
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 0cbfd1eca1dd..f985336b3a22 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <math.h> | 4 | #include <math.h> |
5 | #include "counts.h" | 5 | #include "counts.h" |
6 | #include "stat.h" | 6 | #include "stat.h" |
7 | #include "target.h" | ||
7 | #include "evlist.h" | 8 | #include "evlist.h" |
8 | #include "evsel.h" | 9 | #include "evsel.h" |
9 | #include "thread_map.h" | 10 | #include "thread_map.h" |
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index bcb376e1b3a7..14fe3e548229 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h | |||
@@ -5,13 +5,12 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <sys/types.h> | 7 | #include <sys/types.h> |
8 | #include <sys/time.h> | ||
9 | #include <sys/resource.h> | 8 | #include <sys/resource.h> |
10 | #include <sys/wait.h> | ||
11 | #include "rblist.h" | 9 | #include "rblist.h" |
12 | #include "perf.h" | ||
13 | #include "event.h" | 10 | #include "event.h" |
14 | 11 | ||
12 | struct timespec; | ||
13 | |||
15 | struct stats { | 14 | struct stats { |
16 | double n, mean, M2; | 15 | double n, mean, M2; |
17 | u64 max, min; | 16 | u64 max, min; |
@@ -199,6 +198,8 @@ int perf_stat_process_counter(struct perf_stat_config *config, | |||
199 | struct perf_tool; | 198 | struct perf_tool; |
200 | union perf_event; | 199 | union perf_event; |
201 | struct perf_session; | 200 | struct perf_session; |
201 | struct target; | ||
202 | |||
202 | int perf_event__process_stat_event(struct perf_session *session, | 203 | int perf_event__process_stat_event(struct perf_session *session, |
203 | union perf_event *event); | 204 | union perf_event *event); |
204 | 205 | ||
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index bbf7816cba31..dbcb9cfb0f2f 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -169,7 +169,7 @@ struct namespaces *thread__namespaces(struct thread *thread) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | static int __thread__set_namespaces(struct thread *thread, u64 timestamp, | 171 | static int __thread__set_namespaces(struct thread *thread, u64 timestamp, |
172 | struct namespaces_event *event) | 172 | struct perf_record_namespaces *event) |
173 | { | 173 | { |
174 | struct namespaces *new, *curr = __thread__namespaces(thread); | 174 | struct namespaces *new, *curr = __thread__namespaces(thread); |
175 | 175 | ||
@@ -193,7 +193,7 @@ static int __thread__set_namespaces(struct thread *thread, u64 timestamp, | |||
193 | } | 193 | } |
194 | 194 | ||
195 | int thread__set_namespaces(struct thread *thread, u64 timestamp, | 195 | int thread__set_namespaces(struct thread *thread, u64 timestamp, |
196 | struct namespaces_event *event) | 196 | struct perf_record_namespaces *event) |
197 | { | 197 | { |
198 | int ret; | 198 | int ret; |
199 | 199 | ||
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index bf06113be4f3..51bdb9a7af7f 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | struct addr_location; | 17 | struct addr_location; |
18 | struct map; | 18 | struct map; |
19 | struct namespaces_event; | 19 | struct perf_record_namespaces; |
20 | struct thread_stack; | 20 | struct thread_stack; |
21 | struct unwind_libunwind_ops; | 21 | struct unwind_libunwind_ops; |
22 | 22 | ||
@@ -74,7 +74,7 @@ static inline void thread__exited(struct thread *thread) | |||
74 | 74 | ||
75 | struct namespaces *thread__namespaces(struct thread *thread); | 75 | struct namespaces *thread__namespaces(struct thread *thread); |
76 | int thread__set_namespaces(struct thread *thread, u64 timestamp, | 76 | int thread__set_namespaces(struct thread *thread, u64 timestamp, |
77 | struct namespaces_event *event); | 77 | struct perf_record_namespaces *event); |
78 | 78 | ||
79 | int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp, | 79 | int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp, |
80 | bool exec); | 80 | bool exec); |
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index 7f95dd1d6883..2abbf668b8de 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h | |||
@@ -56,7 +56,7 @@ struct perf_tool { | |||
56 | throttle, | 56 | throttle, |
57 | unthrottle, | 57 | unthrottle, |
58 | ksymbol, | 58 | ksymbol, |
59 | bpf_event; | 59 | bpf; |
60 | 60 | ||
61 | event_attr_op attr; | 61 | event_attr_op attr; |
62 | event_attr_op event_update; | 62 | event_attr_op event_update; |
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index dc4bb6e52a83..7367433e767a 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "tool.h" | 5 | #include "tool.h" |
6 | #include "evswitch.h" | 6 | #include "evswitch.h" |
7 | #include "annotate.h" | 7 | #include "annotate.h" |
8 | #include "record.h" | ||
8 | #include <linux/types.h> | 9 | #include <linux/types.h> |
9 | #include <stddef.h> | 10 | #include <stddef.h> |
10 | #include <stdbool.h> | 11 | #include <stdbool.h> |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 6fd130a5d8f2..44211e483fbf 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -43,26 +43,6 @@ void perf_set_multithreaded(void) | |||
43 | 43 | ||
44 | unsigned int page_size; | 44 | unsigned int page_size; |
45 | 45 | ||
46 | #ifdef _SC_LEVEL1_DCACHE_LINESIZE | ||
47 | #define cache_line_size(cacheline_sizep) *cacheline_sizep = sysconf(_SC_LEVEL1_DCACHE_LINESIZE) | ||
48 | #else | ||
49 | static void cache_line_size(int *cacheline_sizep) | ||
50 | { | ||
51 | if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep)) | ||
52 | pr_debug("cannot determine cache line size"); | ||
53 | } | ||
54 | #endif | ||
55 | |||
56 | int cacheline_size(void) | ||
57 | { | ||
58 | static int size; | ||
59 | |||
60 | if (!size) | ||
61 | cache_line_size(&size); | ||
62 | |||
63 | return size; | ||
64 | } | ||
65 | |||
66 | int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH; | 46 | int sysctl_perf_event_max_stack = PERF_MAX_STACK_DEPTH; |
67 | int sysctl_perf_event_max_contexts_per_stack = PERF_MAX_CONTEXTS_PER_STACK; | 47 | int sysctl_perf_event_max_contexts_per_stack = PERF_MAX_CONTEXTS_PER_STACK; |
68 | 48 | ||
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 0dab140c6517..45a5c6f20197 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -34,7 +34,6 @@ int copyfile_offset(int ifd, loff_t off_in, int ofd, loff_t off_out, u64 size); | |||
34 | size_t hex_width(u64 v); | 34 | size_t hex_width(u64 v); |
35 | 35 | ||
36 | extern unsigned int page_size; | 36 | extern unsigned int page_size; |
37 | int __pure cacheline_size(void); | ||
38 | 37 | ||
39 | int sysctl__max_stack(void); | 38 | int sysctl__max_stack(void); |
40 | 39 | ||