8 #if defined(__i386__) || defined(__x86_64__) 16 #elif defined(__linux__) 19 #include <sys/syscall.h> 20 #include <linux/perf_event.h> 23 static struct perf_event_attr attr;
27 attr.type = PERF_TYPE_HARDWARE;
28 attr.config = PERF_COUNT_HW_CPU_CYCLES;
29 fd = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0);
42 if (fd == -1 || read(fd, &result,
sizeof(result)) < (ssize_t)
sizeof(result)) {
uint64_t perf_cpucycles(void)
Functions for measurement of CPU cycles.