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.

 채택된 답변

MathWorks Support Team
MathWorks Support Team 2022년 2월 15일

0 개 추천

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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품

릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by