For code execution profiling, to reduce the communication channel bandwidth usage during a software-in-the-loop (SIL) simulation, processor-in-the-loop simulation (PIL), or XCP external mode simulation, you can capture and store only these profiling metrics on the target hardware:
Maximum execution time of code section
Average execution time of code section
Number of calls to code section
At the end of the simulation, Simulink® uploads the metrics from the target hardware to your development computer.
To run a SIL simulation that generates only the main execution-time metrics:
rtwdemo_sil_topmodel model, which has two subsystems
On the SIL/PIL tab, in the Mode section, select SIL/PIL Simulation Only.
In the Prepare section, specify these settings:
System Under Test —
SIL/PIL Mode —
To measure code execution times for the subsystems:
In the Configuration Parameters dialog box, select Measure task
execution time, which provides execution-time metrics for the task
generated from the top model
Set Measure function execution times to
Coarse (referenced models and subsystems only), which
provides execution-time metrics for the functions generated from the subsystems
Specify a Workspace variable, for example,
executionProfile. If the Data Import/Export > Single simulation output check box is selected, the software creates the variable in the
Simulink.SimulationOutput object that you specify.
From the Save options drop-down list, select
In the Prepare section, click Settings. Under Coverage, click the Coverage Collection button off.
In the Run section, click Run SIL/PIL.
The simulation generates the variable
executionProfile in the
MATLAB® base workspace.
To open the code execution profiling report, in the Profiling window, click the displayed link. In section 2, the report displays the profiled code sections as a flattened list.
The software cannot extract the hierarchy of calls to code sections because this information is not stored on the target hardware.
Overhead filtering is
not supported when Save options is set to