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.

 Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 15 Fév 2022

0 votes

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.

Plus de réponses (0)

Catégories

En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange

Produits

Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by