ARM Cortex A-chip emulator: How to estimate processing time?

3 visualizaciones (últimos 30 días)
Hi all,
I have a piece of code and I would like to know how fast it would run on an ARM Cortex A-chip. I downloaded and installed the required emulator packages as described HERE. My code is not a SIMULINK model, but a bunch of MATLAB functions, so I am using the example in HERE as a guideline as to how to properly compile it and run it.
I got the example (simple addition of two vectors of singles) running no problem, however I am not sure how to estimate the processing time. If I open the profiling report (as described on the example page) I get average and maximum times that are way lower compared to what I get from (tic,toc). Why could that be?
As far as I have read, when you use the profiler for standard MATLAB code it only consider functions and it deactivates some JIT features, but I am using it for a single PIL MEX function here so I don't think those come into play.
I have some guesses, but I would appreciate the input of someone who knows.

Respuesta aceptada

Darshan Ramakant Bhat
Darshan Ramakant Bhat el 11 de Jun. de 2021
You have observed it correctly.
When you execure a PIL MEX at a high level below things will happen :
  • Marshall the input data from MATLAB to C/C++
  • Establish communication with the actual processor (hardware)
  • Execute the code in processor
  • Marshall back the results from C/C++ to MATLAB
So the tic toc will measure the time taken by all these events.
On the otherhand the profiler will capture only the actual execution time in the processor using the instrumenting techniques.
So the profiler data will give you some estimation of the actual exectuion time if you were to deploy the code to the hardware and execute natively in that hardware.
I have created a similar example for SIL execution time. I my machine below are the timing data :
Time taken by SIL using tic-toc : 5.2 ms
Profiler exection time (Average) : 0.6 ms
I hope this helps.
  3 comentarios
Bernardo Hernandez
Bernardo Hernandez el 12 de Jun. de 2021
Quick question. Is this the same with a standard "mex" function? Will (tic,toc) give me "inflated" processing times because of some sort of internal communication when running the mex function?
Darshan Ramakant Bhat
Darshan Ramakant Bhat el 14 de Jun. de 2021
In case of standard MEX all the execution will happen in the host computer. So the tic toc time should be alomst same as the profiler time. Also in case of standard MEX it is meant to be run in MATLAB (not like SIL where in you will deploy the code to another hardware) so the marshalling and unmarshalling will be integral part of "Running the MEX".
You can refer to MEX profiling if you want to measure performance of differnet parts of the code :

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by