Main Content

Performance

Execution time profiling, memory usage profiling, optimized code

When you are ready to generate production code, to improve performance, use configuration options and advanced optimizations. You can use the options and optimizations described in the MATLAB® Coder™ product documentation. With Embedded Coder®, you can also use execution-time profiling and memory usage profiling to analyze performance.

Use execution-time profiling to:

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

  • Determine code sections that require performance improvements.

The static code metrics report includes metrics on files, global variables, and functions. The static code metrics report helps you to determine which global variables and function call paths affect performance.

Functions

expand all

ExecutionTimeInSecondsGet execution time in seconds for profiled section of code (MATLAB code generation)
ExecutionTimeInTicksGet execution times in timer ticks for profiled section of code (MATLAB code generation)
getCoderExecutionProfileExtract execution-time profile for code generated from MATLAB function (MATLAB code generation)
NameGet name of profiled code section (MATLAB code generation)
NumberGet number that uniquely identifies profiled code section (MATLAB code generation)
NumCallsTotal number of calls to profiled code section (MATLAB code generation)
reportOpen code execution profiling report and specify display of time measurements (MATLAB code generation)
scheduleVisualize task scheduling (MATLAB code generation)
SectionsGet array of coder.profile.ExecutionTimeSection objects for profiled code sections (MATLAB code generation)
SelfTimeInTicksGet number of timer ticks recorded for profiled code section, excluding time spent in child functions (MATLAB code generation)
TimeTime over which code section execution time measurements are made (MATLAB code generation)
TimerTicksPerSecondGet and set number of timer ticks per second (MATLAB code generation)
TotalExecutionTimeInTicksGet total number of timer ticks recorded for profiled code section (MATLAB code generation)
TotalSelfTimeInTicksGet total number of timer ticks recorded for profiled code section, excluding time spent in child functions (MATLAB code generation)
TotalTurnaroundTimeInTicksGet total number of timer ticks between start and finish of the profiled code section over the entire execution. (MATLAB code generation)
TurnaroundTimeInTicksGet number of timer ticks between start and finish of the profiled code section (MATLAB code generation)
MaximumExecutionTimeCallNumGet the call number at which maximum number of timer ticks occurred (MATLAB code generation)
MaximumExecutionTimeInTicksGet maximum number of timer ticks for single invocation of profiled code section (MATLAB code generation)
MaximumSelfTimeCallNumGet the call number at which the maximum number of timer ticks occurred, excluding time spent in child functions (MATLAB code generation)
MaximumSelfTimeInTicksGet the maximum number of timer ticks recorded for profiled code section, excluding time spent in child functions (MATLAB code generation)
MaximumTurnaroundTimeCallNumGet call number for the code section invocation with the maximum number of timer ticks between the start and the finish (MATLAB code generation)
MaximumTurnaroundTimeInTicksGet maximum number of timer ticks between start and finish of a single invocation of profiled code section (MATLAB code generation)

Topics

Execution Time Profiling

Execution Time Profiling for SIL and PIL

Why measure execution times for code generated from entry-point functions.

Generate Execution Time Profile

Enable execution-time profiling for a software-in-the-loop (SIL) or processor-in-the-loop (PIL) execution.

View Execution Times

Open the code execution profiling report generated by a SIL or PIL execution.

Analyze Execution Time Data

Use line commands to analyze execution-time measurements from a SIL or PIL execution.

Memory Usage Profiling

Generating a Static Code Metrics Report for Code Generated from MATLAB Code

Create and explore an example static code metrics report.

Static Code Metrics

The code generator performs static analysis of the generated C or C++ code and provides these metrics in the static code metrics report in the code generation report.

Execution Speed

Simplify Multiply Operations for Array Indexing in Loops

Replace multiply operations with add operations in array indexing in loops in C/C++ code generated from MATLAB code.

Generate SIMD Code for MATLAB Functions

Improve the execution speed of the generated code using Intel SSE and Intel AVX technology.