Execution Profiling for Generated Code
Use code execution profiling to:
Determine whether the generated code meets execution time requirements for real-time deployment on your target hardware.
Identify code sections that require execution speed improvements.
The following tasks represent a general workflow that uses code execution profiling:
With the Simulink® model, design and optimize your algorithm.
Configure the model for code execution profiling, and generate code.
Execute generated code on target hardware. For example, you can perform real-time execution with Simulink Real-Time™ or a target support package.
If you are using Embedded Coder®, you can run software-in-the-loop (SIL), processor-in-the-loop (PIL), and XCP-based external model simulations on your development computer or embedded target hardware.
Analyze execution speed through code execution profiling plots and reports. For example, check that the algorithm code satisfies execution time requirements for real-time deployment:
If the algorithm code easily meets the requirements, consider enhancing your algorithm to exploit available processing power.
If the code cannot be executed in real time, look for ways to reduce execution time.
Identify the tasks that require the most time. For these tasks, investigate whether trade-offs between functionality and speed are possible.
If your target is a multicore processor, distribute the execution of algorithm code across available cores.
If required, refine the model and return to step 2.
To find information about code execution profiling with Simulink products, use the following table.
|Type of Execution||Target||Relevant Products||See|
|Software-in-the-loop (SIL)||Development computer||Embedded Coder||
|Processor-in-the-loop (PIL)||Embedded hardware or instruction set simulator||Embedded Coder||
|XCP external mode||Development computer or custom hardware||Embedded Coder||
|Real-time execution||Simulink Real-Time||Simulink Coder™, Simulink Real-Time||