arm - How to get perf_event results for 2nd Nexus7 with Krait CPU -
all.
i try pmus information such instructions, cycle, cache miss , etc. on 2nd nexus7 krait cpu.
the perf tool not working correctly.
therefore, using follow sample source code in perf_event tutorials.
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/ioctl.h> #include <linux/perf_event.h> #include <asm/unistd.h> static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags) { int ret; ret = syscall(__nr_perf_event_open, hw_event, pid, cpu, group_fd, flags); return ret; } int main(int argc, char **argv) { struct perf_event_attr pe; long long count; int fd; memset(&pe, 0, sizeof(struct perf_event_attr)); pe.type = perf_type_hardware; pe.size = sizeof(struct perf_event_attr); pe.config = perf_count_hw_cpu_cycles; pe.disabled = 1; pe.exclude_kernel = 1; pe.exclude_hv = 1; fd = perf_event_open(&pe, 0, -1, -1, 0); if (fd == -1) { fprintf(stderr, "error opening leader %llx\n", pe.config); exit(exit_failure); } ioctl(fd, perf_event_ioc_reset, 0); ioctl(fd, perf_event_ioc_enable, 0); printf("measuring cycles printf\n"); ioctl(fd, perf_event_ioc_disable, 0); read(fd, &count, sizeof(long long)); printf("used %lld cycles", count); close(fd); }
i tried run code on x86 linux machine. result show "used 123123 cycles."
however, couldn't pmus event on 2nd nexus7. returns "used 0 cycles."
the pmu driver enabled follows.
<6>[ 0.152832] hw perfevents: enabled armv7 krait pmu driver, 5 counters available
also, can find perf_event_msm_krait.c in flo kernel 3.4 used nexus7. (i found patch supporting krait cpu; http://www.serverphorums.com/read.php?12,850329 . includes perf_event_cpu.c file couldn't find in kernel source. way correct in order support pmu nexus7 krait?)
thank in advance.
Comments
Post a Comment