1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _PERF_RECORD_H 3*4882a593Smuzhiyun #define _PERF_RECORD_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <time.h> 6*4882a593Smuzhiyun #include <stdbool.h> 7*4882a593Smuzhiyun #include <linux/types.h> 8*4882a593Smuzhiyun #include <linux/stddef.h> 9*4882a593Smuzhiyun #include <linux/perf_event.h> 10*4882a593Smuzhiyun #include "util/target.h" 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun struct option; 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun struct record_opts { 15*4882a593Smuzhiyun struct target target; 16*4882a593Smuzhiyun bool group; 17*4882a593Smuzhiyun bool inherit_stat; 18*4882a593Smuzhiyun bool no_buffering; 19*4882a593Smuzhiyun bool no_inherit; 20*4882a593Smuzhiyun bool no_inherit_set; 21*4882a593Smuzhiyun bool no_samples; 22*4882a593Smuzhiyun bool raw_samples; 23*4882a593Smuzhiyun bool sample_address; 24*4882a593Smuzhiyun bool sample_phys_addr; 25*4882a593Smuzhiyun bool sample_weight; 26*4882a593Smuzhiyun bool sample_time; 27*4882a593Smuzhiyun bool sample_time_set; 28*4882a593Smuzhiyun bool sample_cpu; 29*4882a593Smuzhiyun bool period; 30*4882a593Smuzhiyun bool period_set; 31*4882a593Smuzhiyun bool running_time; 32*4882a593Smuzhiyun bool full_auxtrace; 33*4882a593Smuzhiyun bool auxtrace_snapshot_mode; 34*4882a593Smuzhiyun bool auxtrace_snapshot_on_exit; 35*4882a593Smuzhiyun bool auxtrace_sample_mode; 36*4882a593Smuzhiyun bool record_namespaces; 37*4882a593Smuzhiyun bool record_cgroup; 38*4882a593Smuzhiyun bool record_switch_events; 39*4882a593Smuzhiyun bool record_switch_events_set; 40*4882a593Smuzhiyun bool all_kernel; 41*4882a593Smuzhiyun bool all_user; 42*4882a593Smuzhiyun bool kernel_callchains; 43*4882a593Smuzhiyun bool user_callchains; 44*4882a593Smuzhiyun bool tail_synthesize; 45*4882a593Smuzhiyun bool overwrite; 46*4882a593Smuzhiyun bool ignore_missing_thread; 47*4882a593Smuzhiyun bool strict_freq; 48*4882a593Smuzhiyun bool sample_id; 49*4882a593Smuzhiyun bool no_bpf_event; 50*4882a593Smuzhiyun bool kcore; 51*4882a593Smuzhiyun bool text_poke; 52*4882a593Smuzhiyun unsigned int freq; 53*4882a593Smuzhiyun unsigned int mmap_pages; 54*4882a593Smuzhiyun unsigned int auxtrace_mmap_pages; 55*4882a593Smuzhiyun unsigned int user_freq; 56*4882a593Smuzhiyun u64 branch_stack; 57*4882a593Smuzhiyun u64 sample_intr_regs; 58*4882a593Smuzhiyun u64 sample_user_regs; 59*4882a593Smuzhiyun u64 default_interval; 60*4882a593Smuzhiyun u64 user_interval; 61*4882a593Smuzhiyun size_t auxtrace_snapshot_size; 62*4882a593Smuzhiyun const char *auxtrace_snapshot_opts; 63*4882a593Smuzhiyun const char *auxtrace_sample_opts; 64*4882a593Smuzhiyun bool sample_transaction; 65*4882a593Smuzhiyun int initial_delay; 66*4882a593Smuzhiyun bool use_clockid; 67*4882a593Smuzhiyun clockid_t clockid; 68*4882a593Smuzhiyun u64 clockid_res_ns; 69*4882a593Smuzhiyun int nr_cblocks; 70*4882a593Smuzhiyun int affinity; 71*4882a593Smuzhiyun int mmap_flush; 72*4882a593Smuzhiyun unsigned int comp_level; 73*4882a593Smuzhiyun unsigned int nr_threads_synthesize; 74*4882a593Smuzhiyun int ctl_fd; 75*4882a593Smuzhiyun int ctl_fd_ack; 76*4882a593Smuzhiyun bool ctl_fd_close; 77*4882a593Smuzhiyun }; 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun extern const char * const *record_usage; 80*4882a593Smuzhiyun extern struct option *record_options; 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun int record__parse_freq(const struct option *opt, const char *str, int unset); 83*4882a593Smuzhiyun record_opts__no_switch_events(const struct record_opts * opts)84*4882a593Smuzhiyunstatic inline bool record_opts__no_switch_events(const struct record_opts *opts) 85*4882a593Smuzhiyun { 86*4882a593Smuzhiyun return opts->record_switch_events_set && !opts->record_switch_events; 87*4882a593Smuzhiyun } 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun #endif // _PERF_RECORD_H 90