perf record: Move record_opts and other record decls out of perf.h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 22 Aug 2019 18:40:29 +0000 (15:40 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 26 Aug 2019 14:58:22 +0000 (11:58 -0300)
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>
30 files changed:
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/arm-spe.c
tools/perf/arch/s390/util/auxtrace.c
tools/perf/arch/x86/tests/perf-time-to-tsc.c
tools/perf/arch/x86/util/intel-bts.c
tools/perf/arch/x86/util/intel-pt.c
tools/perf/builtin-record.c
tools/perf/builtin-script.c
tools/perf/builtin-stat.c
tools/perf/builtin-trace.c
tools/perf/perf.h
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bpf.c
tools/perf/tests/code-reading.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/perf-record.c
tools/perf/tests/switch-tracking.c
tools/perf/tests/task-exit.c
tools/perf/util/auxtrace.c
tools/perf/util/bpf-event.c
tools/perf/util/evsel.c
tools/perf/util/kvm-stat.h
tools/perf/util/machine.c
tools/perf/util/machine.h
tools/perf/util/record.c
tools/perf/util/record.h [new file with mode: 0644]
tools/perf/util/stat.c
tools/perf/util/stat.h
tools/perf/util/top.h

index c73da3245b67141d37bcbe866620131b21d1676e..a185dab2d9037877d78ee00f6699298ad14663e9 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/zalloc.h>
 
 #include "cs-etm.h"
-#include "../../perf.h"
+#include "../../util/record.h"
 #include "../../util/auxtrace.h"
 #include "../../util/cpumap.h"
 #include "../../util/evlist.h"
index 00915b8fd05b02795024bfbc864d877f58257e94..cdd5c0c841839e7c5e8de19e629d58078c02d0ba 100644 (file)
@@ -19,6 +19,7 @@
 #include "../../util/pmu.h"
 #include "../../util/debug.h"
 #include "../../util/auxtrace.h"
+#include "../../util/record.h"
 #include "../../util/arm-spe.h"
 
 #define KiB(x) ((x) * 1024)
index cab46f517b8393c96831deafff8b3365f197bc06..f32d7a72d0398e721947f7d5c984958b29405f6c 100644 (file)
@@ -8,6 +8,7 @@
 #include "../../util/evlist.h"
 #include "../../util/auxtrace.h"
 #include "../../util/evsel.h"
+#include "../../util/record.h"
 
 #define PERF_EVENT_CPUM_SF             0xB0000 /* Event: Basic-sampling */
 #define PERF_EVENT_CPUM_SF_DIAG                0xBD000 /* Event: Combined-sampling */
index 582182d98a7f4a23de34e06038c6e1508761bdc5..02776109ba467298764356eca377b2ecc4234e8d 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <errno.h>
 #include <inttypes.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <linux/types.h>
@@ -13,6 +14,7 @@
 #include "evsel.h"
 #include "thread_map.h"
 #include "cpumap.h"
+#include "record.h"
 #include "tsc.h"
 #include "tests/tests.h"
 
index 2d5d8a12dd1f4f300e20f74ffc1f92057572a87f..1f2cf612bc9c6b4e0f2f9125173d9784356cc648 100644 (file)
@@ -17,6 +17,7 @@
 #include "../../util/session.h"
 #include "../../util/pmu.h"
 #include "../../util/debug.h"
+#include "../../util/record.h"
 #include "../../util/tsc.h"
 #include "../../util/auxtrace.h"
 #include "../../util/intel-bts.h"
index c72a77a82b396042fa6b10c8bac179ebf607dbe9..44cfe72c1a4c6a08c2c55da11332995cd02b6ca7 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/zalloc.h>
 #include <cpuid.h>
 
-#include "../../perf.h"
 #include "../../util/session.h"
 #include "../../util/event.h"
 #include "../../util/evlist.h"
@@ -24,6 +23,8 @@
 #include "../../util/pmu.h"
 #include "../../util/debug.h"
 #include "../../util/auxtrace.h"
+#include "../../util/record.h"
+#include "../../util/target.h"
 #include "../../util/tsc.h"
 #include "../../util/intel-pt.h"
 
index f71631f2bcb5143ecc5dac3d4598d9316310f7a9..359bb8f33e578bf663e4f03556b38b4f00c70a9c 100644 (file)
@@ -8,8 +8,6 @@
  */
 #include "builtin.h"
 
-#include "perf.h"
-
 #include "util/build-id.h"
 #include <subcmd/parse-options.h>
 #include "util/parse-events.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/debug.h"
+#include "util/target.h"
 #include "util/session.h"
 #include "util/tool.h"
 #include "util/symbol.h"
+#include "util/record.h"
 #include "util/cpumap.h"
 #include "util/thread_map.h"
 #include "util/data.h"
index 9b93ddeaeafa704b69f3686b55694227aec1e8bb..ee05621d3bd69697b1e97d3123a36379f40d48a4 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "builtin.h"
 
-#include "perf.h"
 #include "util/cache.h"
 #include "util/counts.h"
 #include "util/debug.h"
@@ -51,6 +50,7 @@
 #include <unistd.h>
 #include <subcmd/pager.h>
 #include <perf/evlist.h>
+#include "util/record.h"
 
 #include <linux/ctype.h>
 
index 8a4f1a7d0cba9a8eff03c08c8eef908ce9346ec1..6ab13f466827ac909d3d8a5c722fcdc086759624 100644 (file)
@@ -40,7 +40,6 @@
  *   Jaswinder Singh Rajput <jaswinder@kernel.org>
  */
 
-#include "perf.h"
 #include "builtin.h"
 #include "util/cgroup.h"
 #include <subcmd/parse-options.h>
@@ -62,6 +61,7 @@
 #include "util/tool.h"
 #include "util/string2.h"
 #include "util/metricgroup.h"
+#include "util/target.h"
 #include "util/top.h"
 #include "asm/bug.h"
 
index de126258ca1056bb4d412f4db9717bddf628c605..8ea62fd2591d08ef91de5d94f6a819d9b8341255 100644 (file)
@@ -14,6 +14,7 @@
  * http://lwn.net/Articles/415728/ ("Announcing a new utility: 'trace'")
  */
 
+#include "util/record.h"
 #include <traceevent/event-parse.h>
 #include <api/fs/tracing_path.h>
 #include <bpf/bpf.h>
index dc0a7a2378875857591b20bf42fa1caf8f855d7f..d9e6b8b957b64e27988a95f0d21372c763c08c9f 100644 (file)
@@ -35,63 +35,6 @@ extern const char perf_version_string[];
 
 void pthread__unblock_sigwinch(void);
 
-#include "util/target.h"
-
-struct record_opts {
-       struct target target;
-       bool         group;
-       bool         inherit_stat;
-       bool         no_buffering;
-       bool         no_inherit;
-       bool         no_inherit_set;
-       bool         no_samples;
-       bool         raw_samples;
-       bool         sample_address;
-       bool         sample_phys_addr;
-       bool         sample_weight;
-       bool         sample_time;
-       bool         sample_time_set;
-       bool         sample_cpu;
-       bool         period;
-       bool         period_set;
-       bool         running_time;
-       bool         full_auxtrace;
-       bool         auxtrace_snapshot_mode;
-       bool         auxtrace_snapshot_on_exit;
-       bool         record_namespaces;
-       bool         record_switch_events;
-       bool         all_kernel;
-       bool         all_user;
-       bool         kernel_callchains;
-       bool         user_callchains;
-       bool         tail_synthesize;
-       bool         overwrite;
-       bool         ignore_missing_thread;
-       bool         strict_freq;
-       bool         sample_id;
-       bool         no_bpf_event;
-       unsigned int freq;
-       unsigned int mmap_pages;
-       unsigned int auxtrace_mmap_pages;
-       unsigned int user_freq;
-       u64          branch_stack;
-       u64          sample_intr_regs;
-       u64          sample_user_regs;
-       u64          default_interval;
-       u64          user_interval;
-       size_t       auxtrace_snapshot_size;
-       const char   *auxtrace_snapshot_opts;
-       bool         sample_transaction;
-       unsigned     initial_delay;
-       bool         use_clockid;
-       clockid_t    clockid;
-       u64          clockid_res_ns;
-       int          nr_cblocks;
-       int          affinity;
-       int          mmap_flush;
-       unsigned int comp_level;
-};
-
 enum perf_affinity {
        PERF_AFFINITY_SYS = 0,
        PERF_AFFINITY_NODE,
@@ -99,10 +42,5 @@ enum perf_affinity {
        PERF_AFFINITY_MAX
 };
 
-struct option;
-extern const char * const *record_usage;
-extern struct option *record_options;
 extern int version_verbose;
-
-int record__parse_freq(const struct option *opt, const char *str, int unset);
 #endif
index 9bdf66139099ac5a96dc120225abdb4bc751af51..b6f27ef9fb02f58ff68277a76e01a0e9e8025a6e 100644 (file)
@@ -4,9 +4,9 @@
  * beginning
  */
 
-#include <perf.h>
 #include <evlist.h>
 #include <sys/prctl.h>
+#include "record.h"
 #include "tests.h"
 #include "debug.h"
 #include <errno.h>
index e16f927f38b6b9129dd72fc5bbfee7c7bcc877fc..98642961fc63ed0b0b1500ac96359546c1c531ea 100644 (file)
@@ -5,6 +5,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <util/record.h>
 #include <util/util.h>
 #include <util/bpf-loader.h>
 #include <util/evlist.h>
index e45df0736261c01f2ddc2b3873eec961f15f3117..fe671b860086e3f14c73e6f063c3e98f99421910 100644 (file)
@@ -20,6 +20,7 @@
 #include "map.h"
 #include "symbol.h"
 #include "event.h"
+#include "record.h"
 #include "thread.h"
 
 #include "tests.h"
index 0ce5ce33bac4c90f6b36e65a44291ad547514362..2af6faf1bbd6487e061fbe98716f2475e02b1ac1 100644 (file)
@@ -8,6 +8,7 @@
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
+#include "record.h"
 #include "thread_map.h"
 #include "cpumap.h"
 #include "tests.h"
index 9c06130d37be7eef1cb835f489cf5bedf7f06e22..62492106fb5e80627fa9e85d9cd130ad2f3dcf81 100644 (file)
@@ -1,12 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <stdbool.h>
 #include <linux/err.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include "perf.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
+#include "record.h"
 #include "tests.h"
 #include "debug.h"
 #include <errno.h>
index 67b388e92cba8e419e4ecf3fd879a2ab39be32ba..3a205f6f936382bf3c0541f3a8fd64bd468f9c04 100644 (file)
@@ -7,8 +7,8 @@
 #include <sched.h>
 #include "evlist.h"
 #include "evsel.h"
-#include "perf.h"
 #include "debug.h"
+#include "record.h"
 #include "tests.h"
 
 static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
index e3cee69f6ea29e638b8695ccb58dfbd0c2120c37..b63f0276872456a161de62f89e88929f0a4e2555 100644 (file)
@@ -13,6 +13,7 @@
 #include "evsel.h"
 #include "thread_map.h"
 #include "cpumap.h"
+#include "record.h"
 #include "tests.h"
 
 static int spin_sleep(void)
index 4ca38fd0379a3c3be55d1b82ee7be3d10c97dbaf..d79a22e2d8be31bb2c8c539a0f35956e19e795bf 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "evlist.h"
 #include "evsel.h"
+#include "target.h"
 #include "thread_map.h"
 #include "cpumap.h"
 #include "tests.h"
index 094e6ceb3cf2a40ba3cea5fb50bf1b4b5c47129c..12e9b7acbb2ca208d89772328b1f6d2ec6fa2652 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/list.h>
 #include <linux/zalloc.h>
 
-#include "../perf.h"
 #include "evlist.h"
 #include "dso.h"
 #include "map.h"
@@ -41,6 +40,7 @@
 #include <linux/hash.h>
 
 #include "event.h"
+#include "record.h"
 #include "session.h"
 #include "debug.h"
 #include <subcmd/parse-options.h>
index 5a5dcc6d8f8588e470a1bed4c77a4c3a2b9e78e5..5c634bcfea7e4e221edd03806ff735244a661f8f 100644 (file)
@@ -14,6 +14,7 @@
 #include "session.h"
 #include "map.h"
 #include "evlist.h"
+#include "record.h"
 
 #define ptr_to_u64(ptr)    ((__u64)(unsigned long)(ptr))
 
index e983e721becaa21cc7f94699eab3cd269013cccc..9fadd5857cccdc2fb3f8bb4e2efb92716377f251 100644 (file)
@@ -34,6 +34,7 @@
 #include "thread_map.h"
 #include "target.h"
 #include "perf_regs.h"
+#include "record.h"
 #include "debug.h"
 #include "trace-event.h"
 #include "stat.h"
index a09c495f866b8bcf036d75fd39fe43871a8acd01..46913637085ba4c483c2302a655564680a2dfebd 100644 (file)
@@ -2,9 +2,9 @@
 #ifndef __PERF_KVM_STAT_H
 #define __PERF_KVM_STAT_H
 
-#include "../perf.h"
 #include "tool.h"
 #include "stat.h"
+#include "record.h"
 
 struct evsel;
 struct evlist;
index 5734460fc89e8ec2d8b6a578b863a9abcefde37f..f7c1a7e6c4bac933a640a2a657d08e07cd4790ba 100644 (file)
@@ -13,6 +13,7 @@
 #include "symbol.h"
 #include "sort.h"
 #include "strlist.h"
+#include "target.h"
 #include "thread.h"
 #include "vdso.h"
 #include <stdbool.h>
index 8b9d7157276d8736c68de36152c76973e20af4d8..7d69119d0b5d157fcb482fb6f9c65da90b6fcdeb 100644 (file)
@@ -14,6 +14,7 @@ struct branch_stack;
 struct evsel;
 struct perf_sample;
 struct symbol;
+struct target;
 struct thread;
 union perf_event;
 
index 51bbd0714e6dd0da296b556ababec3b3cd039913..574507d46c98905df81e46b361e19d8753120467 100644 (file)
@@ -9,6 +9,7 @@
 #include <perf/cpumap.h>
 #include "util.h"
 #include "cloexec.h"
+#include "record.h"
 
 typedef void (*setup_probe_fn_t)(struct evsel *evsel);
 
diff --git a/tools/perf/util/record.h b/tools/perf/util/record.h
new file mode 100644 (file)
index 0000000..00275af
--- /dev/null
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _PERF_RECORD_H
+#define _PERF_RECORD_H
+
+#include <time.h>
+#include <stdbool.h>
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <linux/perf_event.h>
+#include "util/target.h"
+
+struct option;
+
+struct record_opts {
+       struct target target;
+       bool          group;
+       bool          inherit_stat;
+       bool          no_buffering;
+       bool          no_inherit;
+       bool          no_inherit_set;
+       bool          no_samples;
+       bool          raw_samples;
+       bool          sample_address;
+       bool          sample_phys_addr;
+       bool          sample_weight;
+       bool          sample_time;
+       bool          sample_time_set;
+       bool          sample_cpu;
+       bool          period;
+       bool          period_set;
+       bool          running_time;
+       bool          full_auxtrace;
+       bool          auxtrace_snapshot_mode;
+       bool          auxtrace_snapshot_on_exit;
+       bool          record_namespaces;
+       bool          record_switch_events;
+       bool          all_kernel;
+       bool          all_user;
+       bool          kernel_callchains;
+       bool          user_callchains;
+       bool          tail_synthesize;
+       bool          overwrite;
+       bool          ignore_missing_thread;
+       bool          strict_freq;
+       bool          sample_id;
+       bool          no_bpf_event;
+       unsigned int  freq;
+       unsigned int  mmap_pages;
+       unsigned int  auxtrace_mmap_pages;
+       unsigned int  user_freq;
+       u64           branch_stack;
+       u64           sample_intr_regs;
+       u64           sample_user_regs;
+       u64           default_interval;
+       u64           user_interval;
+       size_t        auxtrace_snapshot_size;
+       const char    *auxtrace_snapshot_opts;
+       bool          sample_transaction;
+       unsigned      initial_delay;
+       bool          use_clockid;
+       clockid_t     clockid;
+       u64           clockid_res_ns;
+       int           nr_cblocks;
+       int           affinity;
+       int           mmap_flush;
+       unsigned int  comp_level;
+};
+
+extern const char * const *record_usage;
+extern struct option *record_options;
+
+int record__parse_freq(const struct option *opt, const char *str, int unset);
+
+#endif // _PERF_RECORD_H
index 0cbfd1eca1dd1fb09c2fc26c0f26659f642fdb02..f985336b3a228b3d84beb64066de584d1f2ee593 100644 (file)
@@ -4,6 +4,7 @@
 #include <math.h>
 #include "counts.h"
 #include "stat.h"
+#include "target.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
index 9e425ecd82d946087146da75e479d3850553e47e..14fe3e548229fcc2f8b29bc637791db5f9aa953a 100644 (file)
@@ -198,6 +198,8 @@ int perf_stat_process_counter(struct perf_stat_config *config,
 struct perf_tool;
 union perf_event;
 struct perf_session;
+struct target;
+
 int perf_event__process_stat_event(struct perf_session *session,
                                   union perf_event *event);
 
index dc4bb6e52a83a7327cc714fd171480602004c473..7367433e767a45a396d6f41e178bdcee775732cd 100644 (file)
@@ -5,6 +5,7 @@
 #include "tool.h"
 #include "evswitch.h"
 #include "annotate.h"
+#include "record.h"
 #include <linux/types.h>
 #include <stddef.h>
 #include <stdbool.h>