Execution-Time Profiling From Command Line - MATLAB & Simulink (original) (raw)
Main Content
This example shows how you can use line commands to produce execution-time metrics for generated code.
- Open
SILTopModel
, which has two subsystems and is configured to run a software-in-the-loop (SIL) simulation.
openExample('ecoder/SILPILVerificationExample', ...
supportingFile='SILTopModel.slx') - Configure code execution time profiling:
- Produce execution-time metrics for the task generated from the top model.
set_param(gcs, 'CodeExecutionProfiling', 'on'); - Produce execution-time metrics for functions generated from the subsystems in the model.
set_param(gcs, 'CodeProfilingInstrumentation', 'coarse'); - Save all code profiling data to an object in the base workspace.
set_param(gcs,...
'CodeProfilingSaveOptions', 'AllData');
- Produce execution-time metrics for the task generated from the top model.
- Disable Simulink® Coverage⢠and third-party code coverage analysis.
set_param(gcs,...
'CovEnable', 'off');
covSettings = get_param(gcs, 'CodeCoverageSettings');
covSettings.CoverageTool = 'None';
set_param(gcs, 'CodeCoverageSettings', covSettings);
4. Run the simulation.
The simulation generates the variable executionProfile
(default) in the object simOut
.
5. When the simulation is complete, open the code execution report.
report(simOut.executionProfile)
6. To visualize how the tasks are scheduled and the generated code is executed, run:
schedule(simOut.executionProfile)