Main Content

Time

Time over which code section execution time measurements are made (MATLAB code generation)

Description

example

Time = NthSectionProfile.Time returns a time vector corresponding to the period over which execution times are measured for the code section.

Examples

collapse all

Copy MATLAB® code to your working folder.

src_dir = ...
    fullfile(docroot,'toolbox','coder','examples','kalman');

copyfile(fullfile(src_dir,'kalman01.m'), '.')
copyfile(fullfile(src_dir,'test01_ui.m'), '.')
copyfile(fullfile(src_dir,'plot_trajectory.m'), '.')
copyfile(fullfile(src_dir,'position.mat'), '.')

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 time vector for code section.

time = secondSectionProfile.Time;

Input Arguments

collapse all

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

Output Arguments

collapse all

Time, in seconds, over which measurements are made for code section. Returned as a vector.

Introduced in R2013a