Main Content

Time

Get simulation time for code section

Description

example

SimTime = NthSectionProfile.Time returns a simulation time vector that corresponds to the execution time measurements for the code section.

Examples

collapse all

Run a simulation with a model that is configured to generate a workspace variable with execution time measurements.

rtwdemo_sil_topmodel;
set_param('rtwdemo_sil_topmodel',...
          'CodeExecutionProfiling', 'on');
set_param('rtwdemo_sil_topmodel',...
          'SimulationMode', 'software-in-the-loop (SIL)');
set_param('rtwdemo_sil_topmodel',...
          'CodeProfilingInstrumentation', 'on');
set_param('rtwdemo_sil_topmodel',...
          'CodeProfilingSaveOptions', 'AllData');
sim('rtwdemo_sil_topmodel');
The simulation generates the workspace variable executionProfile (default).

At the end of the simulation, get profile for the seventh code section.

seventhSectionProfile = executionProfile.Sections(7);

Get vector representing simulation time for code section.

simulationTimeVector = seventhSectionProfile.Time;

Input Arguments

collapse all

Object generated by the coder.profile.ExecutionTime property Sections.

Output Arguments

collapse all

Simulation time, in seconds, for section of code. Returned as a vector.

Introduced in R2013a