When you run a SIL or PIL execution with execution time profiling enabled, the software generates a message in the Test Output tab. For example:
Current plot held ### Starting SIL execution for 'kalman01' To terminate execution: clear kalman01_sil Execution profiling data is available for viewing. Open Simulation Data Inspector. Execution profiling report available after termination. Current plot released
To observe streamed execution times while the execution runs,
Simulation Data Inspector link.
To open the code execution profiling report:
Stop SIL Verification link.
The software terminates the execution process and displays a new link.
### Stopping SIL execution for 'kalman01' Execution profiling report: report(getCoderExecutionProfile('kalman01'))
Click the new link.
The report provides:
Information about profiled code sections, which includes time measurements for:
function, for example,
The entry-point function, for example,
function, for example,
Definitions for metrics.
By default, the report displays time in nanoseconds (10-9 seconds).
You can specify the time unit and numeric display format. For example, to display time
in microseconds (10-6 seconds), use the
% Create workspace variable executionProfile=getCoderExecutionProfile('kalman01'); report(executionProfile, ... 'Units', 'Seconds', ... 'ScaleFactor', '1e-06', ... 'NumericFormat', '%0.3f')
The report displays time in seconds only if the timer is calibrated, that is, the number of timer ticks per second is established. On a Windows® machine, the software determines this value for a SIL simulation. On a Linux® machine, you must manually calibrate the timer. For example, if your processor speed is 1 GHz, specify the number of timer ticks per second:
executionProfile.TimerTicksPerSecond = 1e9;
To view execution-time metrics for a code section in the Command Window, on the corresponding row, click the icon .
To display measured execution times, click the Simulation Data Inspector icon . You can use the Simulation Data Inspector to manage and compare plots from various executions.
To display the execution-time distribution, click the icon .
In this example, to create the histogram, the software uses these commands:
executionProfile=getCoderExecutionProfile('kalman01') section=executionProfile.Sections(2); data=section.ExecutionTimeInSeconds; histogram(data, 30,'Normalization','probability');
The following table lists the information provided in the code section profiles.
|Section||Name of function from which code is generated.|
|Maximum Execution Time||Longest time between start and end of code section.|
|Average Execution Time||Average time between start and end of code section.|
|Maximum Self Time||Maximum execution time, excluding time in child sections.|
|Average Self Time||Average execution time, excluding time in child sections.|
|Calls||Number of calls to the code section.|
|Icon that you click to display the profiled code section.|
|Icon that you click to display measured execution times with Simulation Data Inspector.|
|Icon that you click to display the execution-time distribution for the profiled code section.|