This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-R52+: measure the number of executed instructions

Hi 

Is there any way to measure the total number of executed instructions for a piece of code ?

I have tried the PMU event - instructions architecturally executed. But the counted number was much more than the assembly instructions.

Such as

1. executed one assemble instruction (like, ldr), the count of the PMU event 8 is 2

2. executed 12 assemble instructions, the count of the PMU event 8 is 14

3. executed a piece of code - the count of the PMU event 8 is around 500K. I use the system timer to monitor the execution time and then convert to the DMIPS. That is almost 2.5 times of the official DMIPS shown on the ARM website. 

Pls kindly give me some instructions. Thanks.

Grace

  • Accessing the PMU in software requires some instructions, so without knowing exactly how you have set this up it's hard to tell what you are actually measuring. Do you have small reproducer sequence?

  • Hi Peter

    I used the Lauterbach debugger with BMC feature to set up the PMU. Here is the sequence.

    1. Set two breakpoints

    2. At the breakpoint1, set up BMC

    3. BMC will set the PMU automatically

    4. run CPU

    5. At the breakpoint 2, BMC report the number of instruction architecturally executed, which is the same as PMEVCNTR0 (hex:0x14)

    Note: I think the number of assemble instruction between breakpoint1&2 is 18, but what PMU gives is 20.

    BR, Grace

  • I think the problem is the granularity you're trying to read at.  To configure or read the PMU requires executing instructions, and in some case synchronisation.   If you're measuring hundreds of instructions, then the extra instructions to sync+read the PMU don't matter.  If you're measuring 18, then overheads of reading the PMU is going to potentially be a relatively large proportion of the total measured.  

    That's on top of whatever effects you see from the tool's debug illusion.