How do I generate Simulink Profiler Report with execution times of subsystems in my model?

4 views (last 30 days)
My Simulink model interfaces with real-time hardware and performs three tasks:
1) Read sensor data from an external device.
2) Perform calculations.
3) Write control commands to the external device.
The blocks involved in each of these tasks are encapsulated in separate subsystem blocks. I want to know how much time is spent within each subsystem block during a simulation run.
How do I create a Simulink Profiler report with execution times reported in this format?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 May 2020
To set Simulink Profiler to generate a report with the rows in the table showing the processing time taken by each task's subsystem block, follow these steps:
For the subsystem block corresponding to each of the tasks in the model,
1. Right-click on the subsystem block and click on "Block Parameters (Subsystem)" near the bottom of the menu.
2. In the "Main" tab, enable the "Treat as atomic unit" option.
3. In the "Code Generation" tab, in the drop-down menu for "Function Packaging:", select the "Reusable function" option.
4. Click the "OK" button.
In the Simulink model, navigate to the following setting:
Configuration Parameters > "Verification" tab > Measure function execution times
Set to "Coarse (referenced models and subsystems only)"
Click on the OK button.
Now follow one of the procedures to run the model with the profiler on, such as:
>> modelName = 'simulink_model_filename_noExt';
>> load_system(modelName)
>> set_param(modelName,'Profile','on')
>> sim(modelName);
The above solution was verified in MATLAB R2019b.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!