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.

 採用された回答

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.

1 件のコメント

Mikhail
Mikhail 2022 年 3 月 4 日
編集済み: Mikhail 2022 年 3 月 4 日
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeployment, 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