Hi,
How can I use PMU(Performance Monitor Unit) in ARM11 to calculate execution clock cycles of an assembly code.
I am using raspberry pi Model B. I am programming it in assembly language (running assembly program as OS). And want to calculate number of clock cycles it takes to execute my code.
Hello,
according to the ARM1176JZZFS TRM. the following procedures would be taken the number of execution cycles of a target codes.
/* Enable PMU */ mov r0,#1 MCR p15, 0, r0, c15, c12, 0 ; Write Performance Monitor Control Register /* Reset Cycle Counter */ mov r0,#5 MCR p15, 0, r0, c15, c12, 0 ; Write Performance Monitor Control Register /* Meaure */ MRC p15, 0, r0, c15, c12, 1 @ Read Cycle Counter Register <your code> MRC p15, 0, r1, c15, c12, 1 @ Read Cycle Counter Register sub r0.r1.r0 @ Cycle Count of <your code
Best regards,
Yasuhiko Koumoto.
Is there any way I can read register values after execution of an assembly program?
May be save in a file(text or csv etc. on sdcard) or any other easy method?
if you use Raspberry Pi, I think there would be the self C compiler implemented. So, you can use the fprintf function to store the PMU results. I'm not sure this can be possible because I don't have Raspberry Pi.