#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"
 
 #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)
 
 #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 */
 
 // 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>
 #include "evsel.h"
 #include "thread_map.h"
 #include "cpumap.h"
+#include "record.h"
 #include "tsc.h"
 #include "tests/tests.h"
 
 
 #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"
 
 #include <linux/zalloc.h>
 #include <cpuid.h>
 
-#include "../../perf.h"
 #include "../../util/session.h"
 #include "../../util/event.h"
 #include "../../util/evlist.h"
 #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"
 
 
  */
 #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"
 
 // SPDX-License-Identifier: GPL-2.0
 #include "builtin.h"
 
-#include "perf.h"
 #include "util/cache.h"
 #include "util/counts.h"
 #include "util/debug.h"
 #include <unistd.h>
 #include <subcmd/pager.h>
 #include <perf/evlist.h>
+#include "util/record.h"
 
 #include <linux/ctype.h>
 
 
  *   Jaswinder Singh Rajput <jaswinder@kernel.org>
  */
 
-#include "perf.h"
 #include "builtin.h"
 #include "util/cgroup.h"
 #include <subcmd/parse-options.h>
 #include "util/tool.h"
 #include "util/string2.h"
 #include "util/metricgroup.h"
+#include "util/target.h"
 #include "util/top.h"
 #include "asm/bug.h"
 
 
  * 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>
 
 
 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,
        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
 
  * beginning
  */
 
-#include <perf.h>
 #include <evlist.h>
 #include <sys/prctl.h>
+#include "record.h"
 #include "tests.h"
 #include "debug.h"
 #include <errno.h>
 
 #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>
 
 #include "map.h"
 #include "symbol.h"
 #include "event.h"
+#include "record.h"
 #include "thread.h"
 
 #include "tests.h"
 
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
+#include "record.h"
 #include "thread_map.h"
 #include "cpumap.h"
 #include "tests.h"
 
 // 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>
 
 #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)
 
 #include "evsel.h"
 #include "thread_map.h"
 #include "cpumap.h"
+#include "record.h"
 #include "tests.h"
 
 static int spin_sleep(void)
 
 // 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"
 
 #include <linux/list.h>
 #include <linux/zalloc.h>
 
-#include "../perf.h"
 #include "evlist.h"
 #include "dso.h"
 #include "map.h"
 #include <linux/hash.h>
 
 #include "event.h"
+#include "record.h"
 #include "session.h"
 #include "debug.h"
 #include <subcmd/parse-options.h>
 
 #include "session.h"
 #include "map.h"
 #include "evlist.h"
+#include "record.h"
 
 #define ptr_to_u64(ptr)    ((__u64)(unsigned long)(ptr))
 
 
 #include "thread_map.h"
 #include "target.h"
 #include "perf_regs.h"
+#include "record.h"
 #include "debug.h"
 #include "trace-event.h"
 #include "stat.h"
 
 #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;
 
 #include "symbol.h"
 #include "sort.h"
 #include "strlist.h"
+#include "target.h"
 #include "thread.h"
 #include "vdso.h"
 #include <stdbool.h>
 
 struct evsel;
 struct perf_sample;
 struct symbol;
+struct target;
 struct thread;
 union perf_event;
 
 
 #include <perf/cpumap.h>
 #include "util.h"
 #include "cloexec.h"
+#include "record.h"
 
 typedef void (*setup_probe_fn_t)(struct evsel *evsel);
 
 
--- /dev/null
+/* 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
 
 #include <math.h>
 #include "counts.h"
 #include "stat.h"
+#include "target.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
 
 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);
 
 
 #include "tool.h"
 #include "evswitch.h"
 #include "annotate.h"
+#include "record.h"
 #include <linux/types.h>
 #include <stddef.h>
 #include <stdbool.h>