• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
rdclock(void)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 #ifndef MAX_NR_CPUS
28 #define MAX_NR_CPUS			2048
29 #endif
30 
31 extern const char *input_name;
32 extern bool perf_host, perf_guest;
33 extern const char perf_version_string[];
34 
35 void pthread__unblock_sigwinch(void);
36 
37 #include "util/target.h"
38 
39 struct record_opts {
40 	struct target target;
41 	bool	     group;
42 	bool	     inherit_stat;
43 	bool	     no_buffering;
44 	bool	     no_inherit;
45 	bool	     no_inherit_set;
46 	bool	     no_samples;
47 	bool	     raw_samples;
48 	bool	     sample_address;
49 	bool	     sample_phys_addr;
50 	bool	     sample_weight;
51 	bool	     sample_time;
52 	bool	     sample_time_set;
53 	bool	     sample_cpu;
54 	bool	     period;
55 	bool	     period_set;
56 	bool	     running_time;
57 	bool	     full_auxtrace;
58 	bool	     auxtrace_snapshot_mode;
59 	bool	     record_namespaces;
60 	bool	     record_switch_events;
61 	bool	     all_kernel;
62 	bool	     all_user;
63 	bool	     tail_synthesize;
64 	bool	     overwrite;
65 	bool	     ignore_missing_thread;
66 	unsigned int freq;
67 	unsigned int mmap_pages;
68 	unsigned int auxtrace_mmap_pages;
69 	unsigned int user_freq;
70 	u64          branch_stack;
71 	u64	     sample_intr_regs;
72 	u64	     default_interval;
73 	u64	     user_interval;
74 	size_t	     auxtrace_snapshot_size;
75 	const char   *auxtrace_snapshot_opts;
76 	bool	     sample_transaction;
77 	unsigned     initial_delay;
78 	bool         use_clockid;
79 	clockid_t    clockid;
80 	unsigned int proc_map_timeout;
81 };
82 
83 struct option;
84 extern const char * const *record_usage;
85 extern struct option *record_options;
86 #endif
87