diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-05-01 12:29:57 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-05-01 12:38:00 -0400 |
commit | 6eda5838bc5771578986429cde4a0870e1e5f5e1 (patch) | |
tree | 94b77643feda0d312bcd4c5b70fea8a268ef2f81 /Documentation/perf_counter/perf.h | |
parent | 3666932bf2212a8fa77e344c5d946e86787bdbbe (diff) |
perfcounter tools: move common defines ... to local header file
No change, move of duplicated stuff only.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'Documentation/perf_counter/perf.h')
-rw-r--r-- | Documentation/perf_counter/perf.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h new file mode 100644 index 000000000000..391fcc73148a --- /dev/null +++ b/Documentation/perf_counter/perf.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _PERF_PERF_H | ||
2 | #define _PERF_PERF_H | ||
3 | |||
4 | /* | ||
5 | * prctl(PR_TASK_PERF_COUNTERS_DISABLE) will (cheaply) disable all | ||
6 | * counters in the current task. | ||
7 | */ | ||
8 | #define PR_TASK_PERF_COUNTERS_DISABLE 31 | ||
9 | #define PR_TASK_PERF_COUNTERS_ENABLE 32 | ||
10 | |||
11 | #define rdclock() \ | ||
12 | ({ \ | ||
13 | struct timespec ts; \ | ||
14 | \ | ||
15 | clock_gettime(CLOCK_MONOTONIC, &ts); \ | ||
16 | ts.tv_sec * 1000000000ULL + ts.tv_nsec; \ | ||
17 | }) | ||
18 | |||
19 | /* | ||
20 | * Pick up some kernel type conventions: | ||
21 | */ | ||
22 | #define __user | ||
23 | #define asmlinkage | ||
24 | |||
25 | #ifdef __x86_64__ | ||
26 | #define __NR_perf_counter_open 298 | ||
27 | #define rmb() asm volatile("lfence" ::: "memory") | ||
28 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | ||
29 | #endif | ||
30 | |||
31 | #ifdef __i386__ | ||
32 | #define __NR_perf_counter_open 336 | ||
33 | #define rmb() asm volatile("lfence" ::: "memory") | ||
34 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | ||
35 | #endif | ||
36 | |||
37 | #ifdef __powerpc__ | ||
38 | #define __NR_perf_counter_open 319 | ||
39 | #define rmb() asm volatile ("sync" ::: "memory") | ||
40 | #define cpu_relax() asm volatile ("" ::: "memory"); | ||
41 | #endif | ||
42 | |||
43 | #define unlikely(x) __builtin_expect(!!(x), 0) | ||
44 | #define min(x, y) ({ \ | ||
45 | typeof(x) _min1 = (x); \ | ||
46 | typeof(y) _min2 = (y); \ | ||
47 | (void) (&_min1 == &_min2); \ | ||
48 | _min1 < _min2 ? _min1 : _min2; }) | ||
49 | |||
50 | static inline int | ||
51 | sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr, | ||
52 | pid_t pid, int cpu, int group_fd, | ||
53 | unsigned long flags) | ||
54 | { | ||
55 | return syscall(__NR_perf_counter_open, hw_event_uptr, pid, cpu, | ||
56 | group_fd, flags); | ||
57 | } | ||
58 | |||
59 | #define MAX_COUNTERS 64 | ||
60 | #define MAX_NR_CPUS 256 | ||
61 | |||
62 | #define EID(type, id) (((__u64)(type) << PERF_COUNTER_TYPE_SHIFT) | (id)) | ||
63 | |||
64 | #endif | ||