- 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
ARM Cortex A-chip emulator: How to estimate processing time?
3 views (last 30 days)
Show older comments
Bernardo Hernandez
on 10 Jun 2021
Commented: Darshan Ramakant Bhat
on 14 Jun 2021
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.
0 Comments
Accepted Answer
Darshan Ramakant Bhat
on 11 Jun 2021
You have observed it correctly.
When you execure a PIL MEX at a high level below things will happen :
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 Comments
Darshan Ramakant Bhat
on 14 Jun 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 :
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!