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
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.