Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Move record_opts and other record decls out of perf.h

And into a separate util/record.h, to better isolate things and make
sure that those who use record_opts and the other moved declarations
are explicitly including the necessary header.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-31q8mei1qkh74qvkl9nwidfq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+107 -73
+1 -1
tools/perf/arch/arm/util/cs-etm.c
··· 15 15 #include <linux/zalloc.h> 16 16 17 17 #include "cs-etm.h" 18 - #include "../../perf.h" 18 + #include "../../util/record.h" 19 19 #include "../../util/auxtrace.h" 20 20 #include "../../util/cpumap.h" 21 21 #include "../../util/evlist.h"
+1
tools/perf/arch/arm64/util/arm-spe.c
··· 19 19 #include "../../util/pmu.h" 20 20 #include "../../util/debug.h" 21 21 #include "../../util/auxtrace.h" 22 + #include "../../util/record.h" 22 23 #include "../../util/arm-spe.h" 23 24 24 25 #define KiB(x) ((x) * 1024)
+1
tools/perf/arch/s390/util/auxtrace.c
··· 8 8 #include "../../util/evlist.h" 9 9 #include "../../util/auxtrace.h" 10 10 #include "../../util/evsel.h" 11 + #include "../../util/record.h" 11 12 12 13 #define PERF_EVENT_CPUM_SF 0xB0000 /* Event: Basic-sampling */ 13 14 #define PERF_EVENT_CPUM_SF_DIAG 0xBD000 /* Event: Combined-sampling */
+2
tools/perf/arch/x86/tests/perf-time-to-tsc.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <errno.h> 3 3 #include <inttypes.h> 4 + #include <stdbool.h> 4 5 #include <stdio.h> 5 6 #include <unistd.h> 6 7 #include <linux/types.h> ··· 14 13 #include "evsel.h" 15 14 #include "thread_map.h" 16 15 #include "cpumap.h" 16 + #include "record.h" 17 17 #include "tsc.h" 18 18 #include "tests/tests.h" 19 19
+1
tools/perf/arch/x86/util/intel-bts.c
··· 17 17 #include "../../util/session.h" 18 18 #include "../../util/pmu.h" 19 19 #include "../../util/debug.h" 20 + #include "../../util/record.h" 20 21 #include "../../util/tsc.h" 21 22 #include "../../util/auxtrace.h" 22 23 #include "../../util/intel-bts.h"
+2 -1
tools/perf/arch/x86/util/intel-pt.c
··· 13 13 #include <linux/zalloc.h> 14 14 #include <cpuid.h> 15 15 16 - #include "../../perf.h" 17 16 #include "../../util/session.h" 18 17 #include "../../util/event.h" 19 18 #include "../../util/evlist.h" ··· 23 24 #include "../../util/pmu.h" 24 25 #include "../../util/debug.h" 25 26 #include "../../util/auxtrace.h" 27 + #include "../../util/record.h" 28 + #include "../../util/target.h" 26 29 #include "../../util/tsc.h" 27 30 #include "../../util/intel-pt.h" 28 31
+2 -2
tools/perf/builtin-record.c
··· 8 8 */ 9 9 #include "builtin.h" 10 10 11 - #include "perf.h" 12 - 13 11 #include "util/build-id.h" 14 12 #include <subcmd/parse-options.h> 15 13 #include "util/parse-events.h" ··· 20 22 #include "util/evlist.h" 21 23 #include "util/evsel.h" 22 24 #include "util/debug.h" 25 + #include "util/target.h" 23 26 #include "util/session.h" 24 27 #include "util/tool.h" 25 28 #include "util/symbol.h" 29 + #include "util/record.h" 26 30 #include "util/cpumap.h" 27 31 #include "util/thread_map.h" 28 32 #include "util/data.h"
+1 -1
tools/perf/builtin-script.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "builtin.h" 3 3 4 - #include "perf.h" 5 4 #include "util/cache.h" 6 5 #include "util/counts.h" 7 6 #include "util/debug.h" ··· 50 51 #include <unistd.h> 51 52 #include <subcmd/pager.h> 52 53 #include <perf/evlist.h> 54 + #include "util/record.h" 53 55 54 56 #include <linux/ctype.h> 55 57
+1 -1
tools/perf/builtin-stat.c
··· 40 40 * Jaswinder Singh Rajput <jaswinder@kernel.org> 41 41 */ 42 42 43 - #include "perf.h" 44 43 #include "builtin.h" 45 44 #include "util/cgroup.h" 46 45 #include <subcmd/parse-options.h> ··· 61 62 #include "util/tool.h" 62 63 #include "util/string2.h" 63 64 #include "util/metricgroup.h" 65 + #include "util/target.h" 64 66 #include "util/top.h" 65 67 #include "asm/bug.h" 66 68
+1
tools/perf/builtin-trace.c
··· 14 14 * http://lwn.net/Articles/415728/ ("Announcing a new utility: 'trace'") 15 15 */ 16 16 17 + #include "util/record.h" 17 18 #include <traceevent/event-parse.h> 18 19 #include <api/fs/tracing_path.h> 19 20 #include <bpf/bpf.h>
-62
tools/perf/perf.h
··· 35 35 36 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 38 enum perf_affinity { 96 39 PERF_AFFINITY_SYS = 0, 97 40 PERF_AFFINITY_NODE, ··· 42 99 PERF_AFFINITY_MAX 43 100 }; 44 101 45 - struct option; 46 - extern const char * const *record_usage; 47 - extern struct option *record_options; 48 102 extern int version_verbose; 49 - 50 - int record__parse_freq(const struct option *opt, const char *str, int unset); 51 103 #endif
+1 -1
tools/perf/tests/backward-ring-buffer.c
··· 4 4 * beginning 5 5 */ 6 6 7 - #include <perf.h> 8 7 #include <evlist.h> 9 8 #include <sys/prctl.h> 9 + #include "record.h" 10 10 #include "tests.h" 11 11 #include "debug.h" 12 12 #include <errno.h>
+1
tools/perf/tests/bpf.c
··· 5 5 #include <sys/types.h> 6 6 #include <sys/stat.h> 7 7 #include <fcntl.h> 8 + #include <util/record.h> 8 9 #include <util/util.h> 9 10 #include <util/bpf-loader.h> 10 11 #include <util/evlist.h>
+1
tools/perf/tests/code-reading.c
··· 20 20 #include "map.h" 21 21 #include "symbol.h" 22 22 #include "event.h" 23 + #include "record.h" 23 24 #include "thread.h" 24 25 25 26 #include "tests.h"
+1
tools/perf/tests/keep-tracking.c
··· 8 8 #include "parse-events.h" 9 9 #include "evlist.h" 10 10 #include "evsel.h" 11 + #include "record.h" 11 12 #include "thread_map.h" 12 13 #include "cpumap.h" 13 14 #include "tests.h"
+2 -1
tools/perf/tests/openat-syscall-tp-fields.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include <stdbool.h> 2 3 #include <linux/err.h> 3 4 #include <sys/types.h> 4 5 #include <sys/stat.h> 5 6 #include <fcntl.h> 6 - #include "perf.h" 7 7 #include "evlist.h" 8 8 #include "evsel.h" 9 9 #include "thread_map.h" 10 + #include "record.h" 10 11 #include "tests.h" 11 12 #include "debug.h" 12 13 #include <errno.h>
+1 -1
tools/perf/tests/perf-record.c
··· 7 7 #include <sched.h> 8 8 #include "evlist.h" 9 9 #include "evsel.h" 10 - #include "perf.h" 11 10 #include "debug.h" 11 + #include "record.h" 12 12 #include "tests.h" 13 13 14 14 static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
+1
tools/perf/tests/switch-tracking.c
··· 13 13 #include "evsel.h" 14 14 #include "thread_map.h" 15 15 #include "cpumap.h" 16 + #include "record.h" 16 17 #include "tests.h" 17 18 18 19 static int spin_sleep(void)
+1
tools/perf/tests/task-exit.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "evlist.h" 3 3 #include "evsel.h" 4 + #include "target.h" 4 5 #include "thread_map.h" 5 6 #include "cpumap.h" 6 7 #include "tests.h"
+1 -1
tools/perf/util/auxtrace.c
··· 26 26 #include <linux/list.h> 27 27 #include <linux/zalloc.h> 28 28 29 - #include "../perf.h" 30 29 #include "evlist.h" 31 30 #include "dso.h" 32 31 #include "map.h" ··· 40 41 #include <linux/hash.h> 41 42 42 43 #include "event.h" 44 + #include "record.h" 43 45 #include "session.h" 44 46 #include "debug.h" 45 47 #include <subcmd/parse-options.h>
+1
tools/perf/util/bpf-event.c
··· 14 14 #include "session.h" 15 15 #include "map.h" 16 16 #include "evlist.h" 17 + #include "record.h" 17 18 18 19 #define ptr_to_u64(ptr) ((__u64)(unsigned long)(ptr)) 19 20
+1
tools/perf/util/evsel.c
··· 34 34 #include "thread_map.h" 35 35 #include "target.h" 36 36 #include "perf_regs.h" 37 + #include "record.h" 37 38 #include "debug.h" 38 39 #include "trace-event.h" 39 40 #include "stat.h"
+1 -1
tools/perf/util/kvm-stat.h
··· 2 2 #ifndef __PERF_KVM_STAT_H 3 3 #define __PERF_KVM_STAT_H 4 4 5 - #include "../perf.h" 6 5 #include "tool.h" 7 6 #include "stat.h" 7 + #include "record.h" 8 8 9 9 struct evsel; 10 10 struct evlist;
+1
tools/perf/util/machine.c
··· 13 13 #include "symbol.h" 14 14 #include "sort.h" 15 15 #include "strlist.h" 16 + #include "target.h" 16 17 #include "thread.h" 17 18 #include "vdso.h" 18 19 #include <stdbool.h>
+1
tools/perf/util/machine.h
··· 14 14 struct evsel; 15 15 struct perf_sample; 16 16 struct symbol; 17 + struct target; 17 18 struct thread; 18 19 union perf_event; 19 20
+1
tools/perf/util/record.c
··· 9 9 #include <perf/cpumap.h> 10 10 #include "util.h" 11 11 #include "cloexec.h" 12 + #include "record.h" 12 13 13 14 typedef void (*setup_probe_fn_t)(struct evsel *evsel); 14 15
+74
tools/perf/util/record.h
··· 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
+1
tools/perf/util/stat.c
··· 4 4 #include <math.h> 5 5 #include "counts.h" 6 6 #include "stat.h" 7 + #include "target.h" 7 8 #include "evlist.h" 8 9 #include "evsel.h" 9 10 #include "thread_map.h"
+2
tools/perf/util/stat.h
··· 198 198 struct perf_tool; 199 199 union perf_event; 200 200 struct perf_session; 201 + struct target; 202 + 201 203 int perf_event__process_stat_event(struct perf_session *session, 202 204 union perf_event *event); 203 205
+1
tools/perf/util/top.h
··· 5 5 #include "tool.h" 6 6 #include "evswitch.h" 7 7 #include "annotate.h" 8 + #include "record.h" 8 9 #include <linux/types.h> 9 10 #include <stddef.h> 10 11 #include <stdbool.h>