I set the below kernek configs and built the kernel. And separately built perf in kernel/tools/perf using http://kwangwoo.blogspot.in/2011/11/performance-monitoring-on-arm.html
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PERF_EVENTS=y
CONFIG_PERF_COUNTERS=y
CONFIG_HW_PERF_EVENTS=y
But I get 0 for most of the stuff.
Performance counter stats for 'ls':
21.059054 task-clock # 0.313 CPUs utilized
80 context-switches # 0.004 M/sec
0 CPU-migrations # 0.000 K/sec
139 page-faults # 0.007 M/sec
0 cycles # 0.000 GHz [80.24%]
0 stalled-cycles-frontend # 0.00% frontend cycles idle [64.89%]
0 stalled-cycles-backend # 0.00% backend cycles idle [75.43%]
0 instructions # 0.00 insns per cycle
0 branches # 0.000 K/sec
0 branch-misses # 0.00% of all branches [65.55%]
0.067236380 seconds time elapsed
But I get 0 for most of the counters.
I did this on nexus 4 device. What could be the problem? Can someone please help?