xref: /openbmc/linux/tools/perf/util/record.h (revision afba8b0a)
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	      auxtrace_sample_mode;
36 	bool	      record_namespaces;
37 	bool	      record_cgroup;
38 	bool	      record_switch_events;
39 	bool	      record_switch_events_set;
40 	bool	      all_kernel;
41 	bool	      all_user;
42 	bool	      kernel_callchains;
43 	bool	      user_callchains;
44 	bool	      tail_synthesize;
45 	bool	      overwrite;
46 	bool	      ignore_missing_thread;
47 	bool	      strict_freq;
48 	bool	      sample_id;
49 	bool	      no_bpf_event;
50 	bool	      kcore;
51 	bool	      text_poke;
52 	unsigned int  freq;
53 	unsigned int  mmap_pages;
54 	unsigned int  auxtrace_mmap_pages;
55 	unsigned int  user_freq;
56 	u64	      branch_stack;
57 	u64	      sample_intr_regs;
58 	u64	      sample_user_regs;
59 	u64	      default_interval;
60 	u64	      user_interval;
61 	size_t	      auxtrace_snapshot_size;
62 	const char    *auxtrace_snapshot_opts;
63 	const char    *auxtrace_sample_opts;
64 	bool	      sample_transaction;
65 	int	      initial_delay;
66 	bool	      use_clockid;
67 	clockid_t     clockid;
68 	u64	      clockid_res_ns;
69 	int	      nr_cblocks;
70 	int	      affinity;
71 	int	      mmap_flush;
72 	unsigned int  comp_level;
73 	unsigned int  nr_threads_synthesize;
74 	int	      ctl_fd;
75 	int	      ctl_fd_ack;
76 	bool	      ctl_fd_close;
77 };
78 
79 extern const char * const *record_usage;
80 extern struct option *record_options;
81 
82 int record__parse_freq(const struct option *opt, const char *str, int unset);
83 
84 static inline bool record_opts__no_switch_events(const struct record_opts *opts)
85 {
86 	return opts->record_switch_events_set && !opts->record_switch_events;
87 }
88 
89 #endif // _PERF_RECORD_H
90