diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /tools/perf/perf.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'tools/perf/perf.h')
-rw-r--r-- | tools/perf/perf.h | 107 |
1 files changed, 15 insertions, 92 deletions
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 2c340e7da45..a5fc660c1f1 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -5,88 +5,76 @@ struct winsize; | |||
5 | 5 | ||
6 | void get_term_dimensions(struct winsize *ws); | 6 | void get_term_dimensions(struct winsize *ws); |
7 | 7 | ||
8 | #include <asm/unistd.h> | ||
9 | |||
10 | #if defined(__i386__) | 8 | #if defined(__i386__) |
9 | #include "../../arch/x86/include/asm/unistd.h" | ||
11 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 10 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
12 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 11 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
13 | #define CPUINFO_PROC "model name" | ||
14 | #ifndef __NR_perf_event_open | ||
15 | # define __NR_perf_event_open 336 | ||
16 | #endif | ||
17 | #endif | 12 | #endif |
18 | 13 | ||
19 | #if defined(__x86_64__) | 14 | #if defined(__x86_64__) |
15 | #include "../../arch/x86/include/asm/unistd.h" | ||
20 | #define rmb() asm volatile("lfence" ::: "memory") | 16 | #define rmb() asm volatile("lfence" ::: "memory") |
21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 17 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
22 | #define CPUINFO_PROC "model name" | ||
23 | #ifndef __NR_perf_event_open | ||
24 | # define __NR_perf_event_open 298 | ||
25 | #endif | ||
26 | #endif | 18 | #endif |
27 | 19 | ||
28 | #ifdef __powerpc__ | 20 | #ifdef __powerpc__ |
29 | #include "../../arch/powerpc/include/uapi/asm/unistd.h" | 21 | #include "../../arch/powerpc/include/asm/unistd.h" |
30 | #define rmb() asm volatile ("sync" ::: "memory") | 22 | #define rmb() asm volatile ("sync" ::: "memory") |
31 | #define cpu_relax() asm volatile ("" ::: "memory"); | 23 | #define cpu_relax() asm volatile ("" ::: "memory"); |
32 | #define CPUINFO_PROC "cpu" | ||
33 | #endif | 24 | #endif |
34 | 25 | ||
35 | #ifdef __s390__ | 26 | #ifdef __s390__ |
27 | #include "../../arch/s390/include/asm/unistd.h" | ||
36 | #define rmb() asm volatile("bcr 15,0" ::: "memory") | 28 | #define rmb() asm volatile("bcr 15,0" ::: "memory") |
37 | #define cpu_relax() asm volatile("" ::: "memory"); | 29 | #define cpu_relax() asm volatile("" ::: "memory"); |
38 | #endif | 30 | #endif |
39 | 31 | ||
40 | #ifdef __sh__ | 32 | #ifdef __sh__ |
33 | #include "../../arch/sh/include/asm/unistd.h" | ||
41 | #if defined(__SH4A__) || defined(__SH5__) | 34 | #if defined(__SH4A__) || defined(__SH5__) |
42 | # define rmb() asm volatile("synco" ::: "memory") | 35 | # define rmb() asm volatile("synco" ::: "memory") |
43 | #else | 36 | #else |
44 | # define rmb() asm volatile("" ::: "memory") | 37 | # define rmb() asm volatile("" ::: "memory") |
45 | #endif | 38 | #endif |
46 | #define cpu_relax() asm volatile("" ::: "memory") | 39 | #define cpu_relax() asm volatile("" ::: "memory") |
47 | #define CPUINFO_PROC "cpu type" | ||
48 | #endif | 40 | #endif |
49 | 41 | ||
50 | #ifdef __hppa__ | 42 | #ifdef __hppa__ |
43 | #include "../../arch/parisc/include/asm/unistd.h" | ||
51 | #define rmb() asm volatile("" ::: "memory") | 44 | #define rmb() asm volatile("" ::: "memory") |
52 | #define cpu_relax() asm volatile("" ::: "memory"); | 45 | #define cpu_relax() asm volatile("" ::: "memory"); |
53 | #define CPUINFO_PROC "cpu" | ||
54 | #endif | 46 | #endif |
55 | 47 | ||
56 | #ifdef __sparc__ | 48 | #ifdef __sparc__ |
49 | #include "../../arch/sparc/include/asm/unistd.h" | ||
57 | #define rmb() asm volatile("":::"memory") | 50 | #define rmb() asm volatile("":::"memory") |
58 | #define cpu_relax() asm volatile("":::"memory") | 51 | #define cpu_relax() asm volatile("":::"memory") |
59 | #define CPUINFO_PROC "cpu" | ||
60 | #endif | 52 | #endif |
61 | 53 | ||
62 | #ifdef __alpha__ | 54 | #ifdef __alpha__ |
55 | #include "../../arch/alpha/include/asm/unistd.h" | ||
63 | #define rmb() asm volatile("mb" ::: "memory") | 56 | #define rmb() asm volatile("mb" ::: "memory") |
64 | #define cpu_relax() asm volatile("" ::: "memory") | 57 | #define cpu_relax() asm volatile("" ::: "memory") |
65 | #define CPUINFO_PROC "cpu model" | ||
66 | #endif | 58 | #endif |
67 | 59 | ||
68 | #ifdef __ia64__ | 60 | #ifdef __ia64__ |
61 | #include "../../arch/ia64/include/asm/unistd.h" | ||
69 | #define rmb() asm volatile ("mf" ::: "memory") | 62 | #define rmb() asm volatile ("mf" ::: "memory") |
70 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") | 63 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") |
71 | #define CPUINFO_PROC "model name" | ||
72 | #endif | 64 | #endif |
73 | 65 | ||
74 | #ifdef __arm__ | 66 | #ifdef __arm__ |
67 | #include "../../arch/arm/include/asm/unistd.h" | ||
75 | /* | 68 | /* |
76 | * Use the __kuser_memory_barrier helper in the CPU helper page. See | 69 | * Use the __kuser_memory_barrier helper in the CPU helper page. See |
77 | * arch/arm/kernel/entry-armv.S in the kernel source for details. | 70 | * arch/arm/kernel/entry-armv.S in the kernel source for details. |
78 | */ | 71 | */ |
79 | #define rmb() ((void(*)(void))0xffff0fa0)() | 72 | #define rmb() ((void(*)(void))0xffff0fa0)() |
80 | #define cpu_relax() asm volatile("":::"memory") | 73 | #define cpu_relax() asm volatile("":::"memory") |
81 | #define CPUINFO_PROC "Processor" | ||
82 | #endif | ||
83 | |||
84 | #ifdef __aarch64__ | ||
85 | #define rmb() asm volatile("dmb ld" ::: "memory") | ||
86 | #define cpu_relax() asm volatile("yield" ::: "memory") | ||
87 | #endif | 74 | #endif |
88 | 75 | ||
89 | #ifdef __mips__ | 76 | #ifdef __mips__ |
77 | #include "../../arch/mips/include/asm/unistd.h" | ||
90 | #define rmb() asm volatile( \ | 78 | #define rmb() asm volatile( \ |
91 | ".set mips2\n\t" \ | 79 | ".set mips2\n\t" \ |
92 | "sync\n\t" \ | 80 | "sync\n\t" \ |
@@ -95,7 +83,6 @@ void get_term_dimensions(struct winsize *ws); | |||
95 | : /* no input */ \ | 83 | : /* no input */ \ |
96 | : "memory") | 84 | : "memory") |
97 | #define cpu_relax() asm volatile("" ::: "memory") | 85 | #define cpu_relax() asm volatile("" ::: "memory") |
98 | #define CPUINFO_PROC "cpu model" | ||
99 | #endif | 86 | #endif |
100 | 87 | ||
101 | #include <time.h> | 88 | #include <time.h> |
@@ -103,7 +90,7 @@ void get_term_dimensions(struct winsize *ws); | |||
103 | #include <sys/types.h> | 90 | #include <sys/types.h> |
104 | #include <sys/syscall.h> | 91 | #include <sys/syscall.h> |
105 | 92 | ||
106 | #include <linux/perf_event.h> | 93 | #include "../../include/linux/perf_event.h" |
107 | #include "util/types.h" | 94 | #include "util/types.h" |
108 | #include <stdbool.h> | 95 | #include <stdbool.h> |
109 | 96 | ||
@@ -165,25 +152,14 @@ static inline unsigned long long rdclock(void) | |||
165 | (void) (&_min1 == &_min2); \ | 152 | (void) (&_min1 == &_min2); \ |
166 | _min1 < _min2 ? _min1 : _min2; }) | 153 | _min1 < _min2 ? _min1 : _min2; }) |
167 | 154 | ||
168 | extern bool test_attr__enabled; | ||
169 | void test_attr__init(void); | ||
170 | void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, | ||
171 | int fd, int group_fd, unsigned long flags); | ||
172 | |||
173 | static inline int | 155 | static inline int |
174 | sys_perf_event_open(struct perf_event_attr *attr, | 156 | sys_perf_event_open(struct perf_event_attr *attr, |
175 | pid_t pid, int cpu, int group_fd, | 157 | pid_t pid, int cpu, int group_fd, |
176 | unsigned long flags) | 158 | unsigned long flags) |
177 | { | 159 | { |
178 | int fd; | 160 | attr->size = sizeof(*attr); |
179 | 161 | return syscall(__NR_perf_event_open, attr, pid, cpu, | |
180 | fd = syscall(__NR_perf_event_open, attr, pid, cpu, | 162 | group_fd, flags); |
181 | group_fd, flags); | ||
182 | |||
183 | if (unlikely(test_attr__enabled)) | ||
184 | test_attr__open(attr, pid, cpu, fd, group_fd, flags); | ||
185 | |||
186 | return fd; | ||
187 | } | 163 | } |
188 | 164 | ||
189 | #define MAX_COUNTERS 256 | 165 | #define MAX_COUNTERS 256 |
@@ -194,59 +170,6 @@ struct ip_callchain { | |||
194 | u64 ips[0]; | 170 | u64 ips[0]; |
195 | }; | 171 | }; |
196 | 172 | ||
197 | struct branch_flags { | ||
198 | u64 mispred:1; | ||
199 | u64 predicted:1; | ||
200 | u64 reserved:62; | ||
201 | }; | ||
202 | |||
203 | struct branch_entry { | ||
204 | u64 from; | ||
205 | u64 to; | ||
206 | struct branch_flags flags; | ||
207 | }; | ||
208 | |||
209 | struct branch_stack { | ||
210 | u64 nr; | ||
211 | struct branch_entry entries[0]; | ||
212 | }; | ||
213 | |||
214 | extern const char *input_name; | ||
215 | extern bool perf_host, perf_guest; | 173 | extern bool perf_host, perf_guest; |
216 | extern const char perf_version_string[]; | ||
217 | |||
218 | void pthread__unblock_sigwinch(void); | ||
219 | |||
220 | #include "util/target.h" | ||
221 | |||
222 | enum perf_call_graph_mode { | ||
223 | CALLCHAIN_NONE, | ||
224 | CALLCHAIN_FP, | ||
225 | CALLCHAIN_DWARF | ||
226 | }; | ||
227 | |||
228 | struct perf_record_opts { | ||
229 | struct perf_target target; | ||
230 | int call_graph; | ||
231 | bool group; | ||
232 | bool inherit_stat; | ||
233 | bool no_delay; | ||
234 | bool no_inherit; | ||
235 | bool no_samples; | ||
236 | bool pipe_output; | ||
237 | bool raw_samples; | ||
238 | bool sample_address; | ||
239 | bool sample_time; | ||
240 | bool sample_id_all_missing; | ||
241 | bool exclude_guest_missing; | ||
242 | bool period; | ||
243 | unsigned int freq; | ||
244 | unsigned int mmap_pages; | ||
245 | unsigned int user_freq; | ||
246 | u64 branch_stack; | ||
247 | u64 default_interval; | ||
248 | u64 user_interval; | ||
249 | u16 stack_dump_size; | ||
250 | }; | ||
251 | 174 | ||
252 | #endif | 175 | #endif |