Main Content

Code Execution-Time Profiling

View and analyze execution-time profiles of code sections

Use execution-time 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), processor-in-the-loop (PIL), or XCP-based external mode simulations to produce execution-time metrics for your generated code. Use the Code Profile Analyzer, code execution report, or Simulation Data Inspector to analyze execution time metrics.

Apps

Code Profile AnalyzerAnalyze execution-time and stack usage profiles for generated code (Since R2023a)

Classes

expand all

target.ProfilingFreezingOverheadCapture freezing and unfreezing instrumentation overhead (Since R2021a)
target.ProfilingFunctionOverheadCapture function instrumentation overhead (Since R2021a)
target.ProfilingTaskOverheadCapture task instrumentation overhead (Since R2021a)
target.TimerProvide timer details for processor (Since R2020b)

Objects

expand all

coder.profile.ExecutionTimeSetAggregate code profiling results from multiple SIL, PIL, or external mode simulations (Since R2023b)

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
scheduleVisualize task scheduling (Since R2021a)
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
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
coder.profile.test.runTestsAutomate analysis of code profiling metrics (Since R2024a)
addAggregate execution-time profiles (Since R2023b)
getExtract specific execution-time profile from aggregate of profiles (Since R2023b)
removeRemove execution-time profile from aggregate of profiles (Since R2023b)

Topics

Workflow Overviews

Profiling Configuration and Results