xref: /openbmc/linux/tools/perf/perf.h (revision 4a3fad70)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PERF_PERF_H
3 #define _PERF_PERF_H
4 
5 #include <time.h>
6 #include <stdbool.h>
7 #include <linux/types.h>
8 #include <linux/perf_event.h>
9 
10 extern bool test_attr__enabled;
11 void test_attr__ready(void);
12 void test_attr__init(void);
13 void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
14 		     int fd, int group_fd, unsigned long flags);
15 
16 #define HAVE_ATTR_TEST
17 #include "perf-sys.h"
18 
19 static inline unsigned long long rdclock(void)
20 {
21 	struct timespec ts;
22 
23 	clock_gettime(CLOCK_MONOTONIC, &ts);
24 	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
25 }
26 
27 #define MAX_NR_CPUS			1024
28 
29 extern const char *input_name;
30 extern bool perf_host, perf_guest;
31 extern const char perf_version_string[];
32 
33 void pthread__unblock_sigwinch(void);
34 
35 #include "util/target.h"
36 
37 struct record_opts {
38 	struct target target;
39 	bool	     group;
40 	bool	     inherit_stat;
41 	bool	     no_buffering;
42 	bool	     no_inherit;
43 	bool	     no_inherit_set;
44 	bool	     no_samples;
45 	bool	     raw_samples;
46 	bool	     sample_address;
47 	bool	     sample_phys_addr;
48 	bool	     sample_weight;
49 	bool	     sample_time;
50 	bool	     sample_time_set;
51 	bool	     sample_cpu;
52 	bool	     period;
53 	bool	     running_time;
54 	bool	     full_auxtrace;
55 	bool	     auxtrace_snapshot_mode;
56 	bool	     record_namespaces;
57 	bool	     record_switch_events;
58 	bool	     all_kernel;
59 	bool	     all_user;
60 	bool	     tail_synthesize;
61 	bool	     overwrite;
62 	bool	     ignore_missing_thread;
63 	unsigned int freq;
64 	unsigned int mmap_pages;
65 	unsigned int auxtrace_mmap_pages;
66 	unsigned int user_freq;
67 	u64          branch_stack;
68 	u64	     sample_intr_regs;
69 	u64	     sample_user_regs;
70 	u64	     default_interval;
71 	u64	     user_interval;
72 	size_t	     auxtrace_snapshot_size;
73 	const char   *auxtrace_snapshot_opts;
74 	bool	     sample_transaction;
75 	unsigned     initial_delay;
76 	bool         use_clockid;
77 	clockid_t    clockid;
78 	unsigned int proc_map_timeout;
79 };
80 
81 struct option;
82 extern const char * const *record_usage;
83 extern struct option *record_options;
84 #endif
85