Main Content

ExecutionTimeInSeconds

Get execution time in seconds for profiled section of code (MATLAB code generation)

Description

example

ExecutionTimes = NthSectionProfile.ExecutionTimeInSeconds returns a vector of execution times, measured in seconds, for the profiled section of code. Each element of ExecutionTimes contains the difference between the timer reading at the start and the end of the section.

Examples

collapse all

Open this example to obtain the files for this tutorial:

  • kalman01.m — MATLAB® function for the Kalman estimator

  • test01_ui.m — MATLAB file to test kalman01.m

  • plot_trajectory.m — File that plots actual target trajectory and Kalman estimator output

  • position.mat — Input data

openExample('ecoder/KalmanFilterExample')

Set up and run a SIL execution.

config = coder.config('lib');
config.GenerateReport = true;

config.VerificationMode = 'SIL';
config.CodeExecutionProfiling = true;

codegen('-config', config, '-args', {zeros(2,1)}, 'kalman01');

coder.runTest('test01_ui', ['kalman01_sil.' mexext]);

At end of the execution, you see the following message.

To terminate execution: clear kalman01_sil
Execution profiling report available after termination.

Click the link clear kalman01_sil.

### Stopping SIL execution for 'kalman01'
    Execution profiling report: report(getCoderExecutionProfile('kalman01'))

Create a workspace variable that holds execution time data.

executionProfile=getCoderExecutionProfile('kalman01');

Get the profile for the second code section.

SecondSectionProfile = executionProfile.Sections(2);

Get vector of execution times for the code section.

time_vector = SecondSectionProfile.ExecutionTimeInSeconds;

Input Arguments

collapse all

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

Output Arguments

collapse all

Execution times, in seconds, for section of code. Returned as a vector.

Version History

Introduced in R2013a