Main Content

Code Execution Profiling

View and analyze execution profiles of code sections

Use code execution profiling to:

  • Establish whether the generated code meets real-time requirements of your target hardware.

  • Determine code sections that require performance improvements.

You can configure software-in-the-loop (SIL) and processor-in-the-loop (PIL) simulations to produce execution-time metrics for tasks and functions in your generated code. Use the code execution report or Simulation Data Inspector to analyze execution times.

Functions

expand all

annotateColor profiled model components or open model with profiled components colored
displayGenerate message that describes how to open code execution profiling report
ExecutionTimeInTicksGet execution times in timer ticks for profiled section of code
ExecutionTimeInSecondsGet execution time in seconds for profiled section of code
NameGet name of profiled code section
NumberGet number that uniquely identifies profiled code section
NumCallsTotal number of calls to profiled code section
SectionsGet array of coder.profile.ExecutionTimeSection objects for profiled code sections
SelfTimeInTicksGet number of timer ticks recorded for profiled code section, excluding time spent in child functions
TimeGet simulation time for code section
timelineDisplay invocations of code sections over execution timeline
TimerTicksPerSecondGet and set number of timer ticks per second
TotalExecutionTimeInTicksGet total number of timer ticks recorded for profiled code section
TotalSelfTimeInTicksGet total number of timer ticks recorded for profiled code section, excluding time spent in child functions
TotalTurnaroundTimeInTicksGet total number of timer ticks between start and finish of the profiled code section over the entire simulation.
TurnaroundTimeInTicksGet number of timer ticks between start and finish of the profiled code section
reportOpen code execution profiling report and specify display of time measurements.
MaximumExecutionTimeCallNumGet the call number at which maximum number of timer ticks occurred
MaximumExecutionTimeInTicksGet maximum number of timer ticks for single invocation of profiled code section
MaximumSelfTimeInTicksGet the maximum number of timer ticks recorded for profiled code section, excluding time spent in child functions
MaximumTurnaroundTimeCallNum Get call number of the maximum number of timer ticks between start and finish of a single invocation of profiled code section
MaximumTurnaroundTimeInTicksGet maximum number of timer ticks between start and finish of a single invocation of profiled code section

Topics

Overview

Execution Profiling for Generated Code

Use code execution profiling to observe code execution speed.

Profiling in SIL and PIL Simulations

Code Execution Profiling with SIL and PIL

Configure SIL or PIL simulation to produce execution-time metrics for generated code.

View and Compare Code Execution Times

Observe code execution times with Simulation Data Inspector and profiling report.

Analyze Code Execution Data

Use line commands to analyze execution-time data.

Remove Instrumentation Overheads from Execution Time Measurements

Improve execution-time profiling on deterministic hardware.

Capture Main Profiling Metrics on Target Hardware

Reduce communication channel bandwidth usage.

Tips and Limitations

A list of tips and known limitations.