Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to measure ARM performance?

Tags:

c

arm

I'm working with optimizing a software and wants to measure the performance. So I am currently simulating an ARM platform with OVP (open virtual platform) and I get the statistics as simulation time and simulated instructions.

My question is, why is the simulated instructions different everytime I run the software (different, but close proximity)? Should it not be the same everytime? Is it not like this , the software that I write in C will be compiled into ARM assembler instructions, and each time the software runs, the simulated instructions will be how many time these ARM assembler instructions run? It should be the same everytime?

How should I measure performance? Take 10 samples of simulated instructions and get the average?

like image 776
MrGigu Avatar asked Jun 17 '11 09:06

MrGigu


1 Answers

From my experience in a real (non-simulated) ARM, if I take cycle counts for a section of the code the number of cycles will vary, this is because:

  • There can be context switches in the middle of your executing code.
  • The initial state of the CPU may be different upon entering the code section. (e.g. the content of the pipeline, branch prediction etc.)
  • The cache state will be different on entry to the code section.
  • External factors such as other hardware accessing external memory.

Due to all these, taking an average (plus some other statistical measures) is really the only practical approach for real hardware and a real OS. In a good simulator some of these factors or potentially eliminated.

On some real chips (or if supported by the simulator) the ARM Performance Monitoring Unit can be useful.

If you're coding for the Cortex A8 this is a cool online cycle counter that can really help you squeeze more performance out of your code.

like image 71
Guy Sirton Avatar answered Oct 02 '22 18:10

Guy Sirton