Code Execution Profiling - Measurement Settings

I am using code execution profiling and I choose different settings for 'Measure function execution times': coarse vs detailed and two different settings for save options: 'summary' vs 'all'
These settings seem to affect the code execution time for the ISR routine drastically:
34us (detailed / all), 28us (detailed / summary), 15us (coarse / summary).
Is this an expected behavior? Can the effect of these settings on execution time be minimized.

 Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 15 de Feb. de 2022

0 votos

This is an expected behavior as the 'detailed' option for 'measure function execution times' parameter introduces excess instrumentation overhead for execution time measurements.
This is also shown as a warning in the diagnostic viewer when one tries to build the model with this option enabled.
Setting the parameter to 'detailed' reports the profiling data for all the function calls inside the task. Instead, set it to 'off' or 'coarse' to get the profiling data for a specific task or an ISR. This data also contains the execution time of all the function calls inside the ISR but does not specifically measure the execution time for each of the function calls.
All these above discussed settings will add a small amount of overhead that cannot be avoided. If it is intended to measure the exact code execution time, consider to toggle a GPIO pin at the start and end of the function and measure the execution time.

1 comentario

Mikhail
Mikhail el 4 de Mzo. de 2022
Editada: Mikhail el 4 de Mzo. de 2022
You should've mentioned this documentation page that talks about removing instrumentation overhead: https://www.mathworks.com/help/ecoder/ug/remove-instrumentation-overhead-from-execution-time-measurements.html

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Deployment, Integration, and Supported Hardware en Centro de ayuda y File Exchange.

Productos

Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by