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");
12 #define CPUINFO_PROC "model name"
15 #if defined(__x86_64__)
16 #include "../../arch/x86/include/asm/unistd.h"
17 #define rmb() asm volatile("lfence" ::: "memory")
18 #define cpu_relax() asm volatile("rep; nop" ::: "memory");
19 #define CPUINFO_PROC "model name"
23 #include "../../arch/powerpc/include/asm/unistd.h"
24 #define rmb() asm volatile ("sync" ::: "memory")
25 #define cpu_relax() asm volatile ("" ::: "memory");
26 #define CPUINFO_PROC "cpu"
30 #include "../../arch/s390/include/asm/unistd.h"
31 #define rmb() asm volatile("bcr 15,0" ::: "memory")
32 #define cpu_relax() asm volatile("" ::: "memory");
36 #include "../../arch/sh/include/asm/unistd.h"
37 #if defined(__SH4A__) || defined(__SH5__)
38 # define rmb() asm volatile("synco" ::: "memory")
40 # define rmb() asm volatile("" ::: "memory")
42 #define cpu_relax() asm volatile("" ::: "memory")
43 #define CPUINFO_PROC "cpu type"
47 #include "../../arch/parisc/include/asm/unistd.h"
48 #define rmb() asm volatile("" ::: "memory")
49 #define cpu_relax() asm volatile("" ::: "memory");
50 #define CPUINFO_PROC "cpu"
54 #include "../../arch/sparc/include/asm/unistd.h"
55 #define rmb() asm volatile("":::"memory")
56 #define cpu_relax() asm volatile("":::"memory")
57 #define CPUINFO_PROC "cpu"
61 #include "../../arch/alpha/include/asm/unistd.h"
62 #define rmb() asm volatile("mb" ::: "memory")
63 #define cpu_relax() asm volatile("" ::: "memory")
64 #define CPUINFO_PROC "cpu model"
68 #include "../../arch/ia64/include/asm/unistd.h"
69 #define rmb() asm volatile ("mf" ::: "memory")
70 #define cpu_relax() asm volatile ("hint @pause" ::: "memory")
71 #define CPUINFO_PROC "model name"
75 #include "../../arch/arm/include/asm/unistd.h"
77 * Use the __kuser_memory_barrier helper in the CPU helper page. See
78 * arch/arm/kernel/entry-armv.S in the kernel source for details.
80 #define rmb() ((void(*)(void))0xffff0fa0)()
81 #define cpu_relax() asm volatile("":::"memory")
82 #define CPUINFO_PROC "Processor"
86 #include "../../arch/mips/include/asm/unistd.h"
87 #define rmb() asm volatile( \
94 #define cpu_relax() asm volatile("" ::: "memory")
95 #define CPUINFO_PROC "cpu model"
100 #include <sys/types.h>
101 #include <sys/syscall.h>
103 #include "../../include/linux/perf_event.h"
104 #include "util/types.h"
113 static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
115 struct perf_event_mmap_page *pc = mm->base;
116 int head = pc->data_head;
121 static inline void perf_mmap__write_tail(struct perf_mmap *md,
124 struct perf_event_mmap_page *pc = md->base;
127 * ensure all reads are done before we write the tail out.
130 pc->data_tail = tail;
134 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
135 * counters in the current task.
137 #define PR_TASK_PERF_EVENTS_DISABLE 31
138 #define PR_TASK_PERF_EVENTS_ENABLE 32
141 # define NSEC_PER_SEC 1000000000ULL
144 static inline unsigned long long rdclock(void)
148 clock_gettime(CLOCK_MONOTONIC, &ts);
149 return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
153 * Pick up some kernel type conventions:
158 #define unlikely(x) __builtin_expect(!!(x), 0)
159 #define min(x, y) ({ \
160 typeof(x) _min1 = (x); \
161 typeof(y) _min2 = (y); \
162 (void) (&_min1 == &_min2); \
163 _min1 < _min2 ? _min1 : _min2; })
166 sys_perf_event_open(struct perf_event_attr *attr,
167 pid_t pid, int cpu, int group_fd,
170 attr->size = sizeof(*attr);
171 return syscall(__NR_perf_event_open, attr, pid, cpu,
175 #define MAX_COUNTERS 256
176 #define MAX_NR_CPUS 256
178 struct ip_callchain {
183 extern bool perf_host, perf_guest;
184 extern const char perf_version_string[];
186 void pthread__unblock_sigwinch(void);
188 struct perf_record_opts {
200 bool sample_id_all_avail;
203 unsigned int user_freq;
204 u64 default_interval;
206 const char *cpu_list;