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