6 void get_term_dimensions(struct winsize
*ws
);
9 #include "../../arch/x86/include/asm/unistd.h"
10 #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
11 #define cpu_relax() asm volatile("rep; nop" ::: "memory");
14 #if defined(__x86_64__)
15 #include "../../arch/x86/include/asm/unistd.h"
16 #define rmb() asm volatile("lfence" ::: "memory")
17 #define cpu_relax() asm volatile("rep; nop" ::: "memory");
21 #include "../../arch/powerpc/include/asm/unistd.h"
22 #define rmb() asm volatile ("sync" ::: "memory")
23 #define cpu_relax() asm volatile ("" ::: "memory");
27 #include "../../arch/s390/include/asm/unistd.h"
28 #define rmb() asm volatile("bcr 15,0" ::: "memory")
29 #define cpu_relax() asm volatile("" ::: "memory");
33 #include "../../arch/sh/include/asm/unistd.h"
34 #if defined(__SH4A__) || defined(__SH5__)
35 # define rmb() asm volatile("synco" ::: "memory")
37 # define rmb() asm volatile("" ::: "memory")
39 #define cpu_relax() asm volatile("" ::: "memory")
43 #include "../../arch/parisc/include/asm/unistd.h"
44 #define rmb() asm volatile("" ::: "memory")
45 #define cpu_relax() asm volatile("" ::: "memory");
49 #include "../../arch/sparc/include/asm/unistd.h"
50 #define rmb() asm volatile("":::"memory")
51 #define cpu_relax() asm volatile("":::"memory")
55 #include "../../arch/alpha/include/asm/unistd.h"
56 #define rmb() asm volatile("mb" ::: "memory")
57 #define cpu_relax() asm volatile("" ::: "memory")
61 #include "../../arch/ia64/include/asm/unistd.h"
62 #define rmb() asm volatile ("mf" ::: "memory")
63 #define cpu_relax() asm volatile ("hint @pause" ::: "memory")
67 #include "../../arch/arm/include/asm/unistd.h"
69 * Use the __kuser_memory_barrier helper in the CPU helper page. See
70 * arch/arm/kernel/entry-armv.S in the kernel source for details.
72 #define rmb() ((void(*)(void))0xffff0fa0)()
73 #define cpu_relax() asm volatile("":::"memory")
77 #include "../../arch/mips/include/asm/unistd.h"
78 #define rmb() asm volatile( \
85 #define cpu_relax() asm volatile("" ::: "memory")
90 #include <sys/types.h>
91 #include <sys/syscall.h>
93 #include "../../include/linux/perf_event.h"
94 #include "util/types.h"
98 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
99 * counters in the current task.
101 #define PR_TASK_PERF_EVENTS_DISABLE 31
102 #define PR_TASK_PERF_EVENTS_ENABLE 32
105 # define NSEC_PER_SEC 1000000000ULL
108 static inline unsigned long long rdclock(void)
112 clock_gettime(CLOCK_MONOTONIC
, &ts
);
113 return ts
.tv_sec
* 1000000000ULL + ts
.tv_nsec
;
117 * Pick up some kernel type conventions:
122 #define unlikely(x) __builtin_expect(!!(x), 0)
123 #define min(x, y) ({ \
124 typeof(x) _min1 = (x); \
125 typeof(y) _min2 = (y); \
126 (void) (&_min1 == &_min2); \
127 _min1 < _min2 ? _min1 : _min2; })
130 sys_perf_event_open(struct perf_event_attr
*attr
,
131 pid_t pid
, int cpu
, int group_fd
,
134 attr
->size
= sizeof(*attr
);
135 return syscall(__NR_perf_event_open
, attr
, pid
, cpu
,
139 #define MAX_COUNTERS 256
140 #define MAX_NR_CPUS 256
142 struct ip_callchain
{
147 extern bool perf_host
, perf_guest
;