Code Execution Profiling
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), processor-in-the-loop (PIL), or XCP-based external mode simulations to produce execution-time metrics for your generated code. Use the code execution report or Simulation Data Inspector to analyze execution times.
|Code Profile Analyzer
|Analyze execution-time and stack usage profiles for generated code (Since R2023a)
|Capture freezing and unfreezing instrumentation overhead (Since R2021a)
|Capture function instrumentation overhead (Since R2021a)
|Capture task instrumentation overhead (Since R2021a)
|Provide timer details for processor (Since R2020b)
|Color profiled model components or open model with profiled components colored
|Generate message that describes how to open code execution profiling report
|Get execution times in timer ticks for profiled section of code
|Get execution time in seconds for profiled section of code
|Get name of profiled code section
|Get number that uniquely identifies profiled code section
|Total number of calls to profiled code section
|Visualize task scheduling (Since R2021a)
|Get array of
coder.profile.ExecutionTimeSection objects for
profiled code sections
|Get number of timer ticks recorded for profiled code section, excluding time spent in child functions
|Get simulation time for code section
|Display invocations of code sections over execution timeline
|Get and set number of timer ticks per second
|Get total number of timer ticks recorded for profiled code section
|Get total number of timer ticks recorded for profiled code section, excluding time spent in child functions
|Get total number of timer ticks between start and finish of the profiled code section over the entire simulation
|Get number of timer ticks between start and finish of the profiled code section
|Open code execution profiling report and specify display of time measurements
Execution-Time Profiling — Maximum Values
|Get the call number at which maximum number of timer ticks occurred
|Get maximum number of timer ticks for single invocation of profiled code section
|Get the maximum number of timer ticks recorded for profiled code section, excluding time spent in child functions
|Get call number of the maximum number of timer ticks between start and finish of a single invocation of profiled code section
|Get maximum number of timer ticks between start and finish of a single invocation of profiled code section
- Execution Profiling for Generated Code
Use code execution profiling to observe code execution speed.
- Aggregate Execution-Time Profiles to Identify Worst Execution
Identify and analyse worst task execution.
Profiling Configuration and Results
- Create Execution-Time Profile for Generated Code
Configure SIL, PIL, or XCP external mode simulation to produce execution-time metrics for generated code.
- View and Compare Code Execution Times
Observe code execution times with Simulation Data Inspector and Code Profile Analyzer.
- Code Execution Profiling Report
Examine report of execution-time metrics for profiled code sections.
- Analyze Code Execution Data
Use line commands to analyze execution-time data.
- Visualize Task Scheduling in XCP External Mode Simulation
Run an XCP external mode simulation that displays task activity and diagnostics and CPU activity and utilization.
- Reduce Bandwidth Usage During Code Execution Profiling
Capture main profiling metrics and display absolute time to reduce communication channel bandwidth usage.
- Code Execution Profiling From the Command Line
Use line commands to configure code execution profiling and view report.
- Remove Instrumentation Overheads from Execution Time Measurements
Improve execution-time profiling on deterministic hardware.
- Tips and Limitations
A list of tips and known limitations.