]>
Commit | Line | Data |
---|---|---|
6eda5838 TG |
1 | #ifndef _PERF_PERF_H |
2 | #define _PERF_PERF_H | |
3 | ||
43599d1f | 4 | #include "perf-sys.h" |
a94d342b PZ |
5 | |
6 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | |
7 | ||
1a482f38 PZ |
8 | #include <time.h> |
9 | #include <unistd.h> | |
10 | #include <sys/types.h> | |
11 | #include <sys/syscall.h> | |
12 | ||
d944c4ee | 13 | #include <linux/types.h> |
d2709c7c | 14 | #include <linux/perf_event.h> |
1a482f38 | 15 | |
a92e7023 TG |
16 | #ifndef NSEC_PER_SEC |
17 | # define NSEC_PER_SEC 1000000000ULL | |
18 | #endif | |
70f7b4a7 DA |
19 | #ifndef NSEC_PER_USEC |
20 | # define NSEC_PER_USEC 1000ULL | |
21 | #endif | |
a92e7023 TG |
22 | |
23 | static inline unsigned long long rdclock(void) | |
24 | { | |
25 | struct timespec ts; | |
26 | ||
27 | clock_gettime(CLOCK_MONOTONIC, &ts); | |
28 | return ts.tv_sec * 1000000000ULL + ts.tv_nsec; | |
29 | } | |
6eda5838 | 30 | |
52502bf2 JO |
31 | extern bool test_attr__enabled; |
32 | void test_attr__init(void); | |
33 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | |
34 | int fd, int group_fd, unsigned long flags); | |
35 | ||
6eda5838 | 36 | static inline int |
cdd6c482 | 37 | sys_perf_event_open(struct perf_event_attr *attr, |
6eda5838 TG |
38 | pid_t pid, int cpu, int group_fd, |
39 | unsigned long flags) | |
40 | { | |
52502bf2 JO |
41 | int fd; |
42 | ||
43 | fd = syscall(__NR_perf_event_open, attr, pid, cpu, | |
44 | group_fd, flags); | |
45 | ||
46 | if (unlikely(test_attr__enabled)) | |
47 | test_attr__open(attr, pid, cpu, fd, group_fd, flags); | |
48 | ||
49 | return fd; | |
6eda5838 TG |
50 | } |
51 | ||
85a9f920 | 52 | #define MAX_NR_CPUS 256 |
6eda5838 | 53 | |
70cb4e96 | 54 | extern const char *input_name; |
8035458f | 55 | extern bool perf_host, perf_guest; |
fbe96f29 | 56 | extern const char perf_version_string[]; |
a1645ce1 | 57 | |
3af6e338 ACM |
58 | void pthread__unblock_sigwinch(void); |
59 | ||
12864b31 | 60 | #include "util/target.h" |
bea03405 | 61 | |
b4006796 | 62 | struct record_opts { |
602ad878 | 63 | struct target target; |
26d33022 | 64 | int call_graph; |
eb853e80 | 65 | bool call_graph_enabled; |
ed80f581 | 66 | bool group; |
0f82ebc4 | 67 | bool inherit_stat; |
509051ea | 68 | bool no_buffering; |
0f82ebc4 | 69 | bool no_inherit; |
69e7e5b0 | 70 | bool no_inherit_set; |
0f82ebc4 ACM |
71 | bool no_samples; |
72 | bool raw_samples; | |
73 | bool sample_address; | |
05484298 | 74 | bool sample_weight; |
0f82ebc4 | 75 | bool sample_time; |
3e76ac78 | 76 | bool period; |
0f82ebc4 | 77 | unsigned int freq; |
01c2d99b | 78 | unsigned int mmap_pages; |
0f82ebc4 | 79 | unsigned int user_freq; |
a00dc319 | 80 | u64 branch_stack; |
0f82ebc4 ACM |
81 | u64 default_interval; |
82 | u64 user_interval; | |
26d33022 | 83 | u16 stack_dump_size; |
475eeab9 | 84 | bool sample_transaction; |
6619a53e | 85 | unsigned initial_delay; |
0f82ebc4 ACM |
86 | }; |
87 | ||
6eda5838 | 88 | #endif |