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_data_page_size;
26 	bool	      sample_code_page_size;
27 	bool	      sample_weight;
28 	bool	      sample_time;
29 	bool	      sample_time_set;
30 	bool	      sample_cpu;
31 	bool	      sample_identifier;
32 	bool	      period;
33 	bool	      period_set;
34 	bool	      running_time;
35 	bool	      full_auxtrace;
36 	bool	      auxtrace_snapshot_mode;
37 	bool	      auxtrace_snapshot_on_exit;
38 	bool	      auxtrace_sample_mode;
39 	bool	      record_namespaces;
40 	bool	      record_cgroup;
41 	bool	      record_switch_events;
42 	bool	      record_switch_events_set;
43 	bool	      all_kernel;
44 	bool	      all_user;
45 	bool	      kernel_callchains;
46 	bool	      user_callchains;
47 	bool	      tail_synthesize;
48 	bool	      overwrite;
49 	bool	      ignore_missing_thread;
50 	bool	      strict_freq;
51 	bool	      sample_id;
52 	bool	      no_bpf_event;
53 	bool	      kcore;
54 	bool	      text_poke;
55 	bool	      build_id;
56 	unsigned int  freq;
57 	unsigned int  mmap_pages;
58 	unsigned int  auxtrace_mmap_pages;
59 	unsigned int  user_freq;
60 	u64	      branch_stack;
61 	u64	      sample_intr_regs;
62 	u64	      sample_user_regs;
63 	u64	      default_interval;
64 	u64	      user_interval;
65 	size_t	      auxtrace_snapshot_size;
66 	const char    *auxtrace_snapshot_opts;
67 	const char    *auxtrace_sample_opts;
68 	bool	      sample_transaction;
69 	int	      initial_delay;
70 	bool	      use_clockid;
71 	clockid_t     clockid;
72 	u64	      clockid_res_ns;
73 	int	      nr_cblocks;
74 	int	      affinity;
75 	int	      mmap_flush;
76 	unsigned int  comp_level;
77 	unsigned int  nr_threads_synthesize;
78 	int	      ctl_fd;
79 	int	      ctl_fd_ack;
80 	bool	      ctl_fd_close;
81 	int	      synth;
82 	int	      threads_spec;
83 	const char    *threads_user_spec;
84 };
85 
86 extern const char * const *record_usage;
87 extern struct option *record_options;
88 
89 int record__parse_freq(const struct option *opt, const char *str, int unset);
90 
record_opts__no_switch_events(const struct record_opts * opts)91 static inline bool record_opts__no_switch_events(const struct record_opts *opts)
92 {
93 	return opts->record_switch_events_set && !opts->record_switch_events;
94 }
95 
96 #endif // _PERF_RECORD_H
97