How to get CPU cycles


Could someone point me to a code to calculate the CPU cycles when running a program or a part of it?

I found this code for x86 on this link. I need something similar for ARM.

I am using ARM Cortex-A15 and Cortex-A7.

Best regards.

More questions in this forum