6 #include <sys/syscall.h>
7 #include <linux/types.h>
8 #include <linux/compiler.h>
9 #include <linux/perf_event.h>
10 #include <asm/barrier.h>
13 #define cpu_relax() asm volatile("rep; nop" ::: "memory");
14 #define CPUINFO_PROC {"model name"}
17 #if defined(__x86_64__)
18 #define cpu_relax() asm volatile("rep; nop" ::: "memory");
19 #define CPUINFO_PROC {"model name"}
23 #define CPUINFO_PROC {"cpu"}
27 #define CPUINFO_PROC {"vendor_id"}
31 #define CPUINFO_PROC {"cpu type"}
35 #define CPUINFO_PROC {"cpu"}
39 #define CPUINFO_PROC {"cpu"}
43 #define CPUINFO_PROC {"cpu model"}
47 #define cpu_relax() asm volatile ("hint @pause" ::: "memory")
48 #define CPUINFO_PROC {"model name"}
52 #define CPUINFO_PROC {"model name", "Processor"}
56 #define cpu_relax() asm volatile("yield" ::: "memory")
60 #define CPUINFO_PROC {"cpu model"}
64 #define CPUINFO_PROC {"Processor"}
68 #define CPUINFO_PROC {"CPU"}
72 #define CPUINFO_PROC {"core ID"}
76 #define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory")
77 #define CPUINFO_PROC {"model name"}
81 #define cpu_relax() barrier()
85 sys_perf_event_open(struct perf_event_attr
*attr
,
86 pid_t pid
, int cpu
, int group_fd
,
91 fd
= syscall(__NR_perf_event_open
, attr
, pid
, cpu
,
95 if (unlikely(test_attr__enabled
))
96 test_attr__open(attr
, pid
, cpu
, fd
, group_fd
, flags
);
101 #endif /* _PERF_SYS_H */