性能
执行时间探查、内存使用量探查、优化的代码
当您准备好生成生产代码时,为了提高性能,请使用配置选项和高级优化。您可以使用 MATLAB® Coder™ 产品文档中介绍的选项和优化。利用 Embedded Coder®,您还可以通过执行时间探查和内存使用量探查来分析性能。
通过执行时间探查可以:
确定生成的代码是否满足硬件的实时要求。
确定哪些代码节需要进行性能改进。
静态代码度量报告包含有关文件、全局变量和函数的各种度量。静态代码度量报告可帮助您确定哪些全局变量和函数调用路径会影响性能。要确定运行生成的代码所需的堆栈内存的大小,您可以运行软件在环 (SIL) 和处理器在环 (PIL) 执行来生成堆栈使用量探查。
App
代码探查分析器 | Analyze execution-time and stack usage profiles for generated code (自 R2023a 起) |
函数
对象
主题
执行时间探查
- SIL 和 PIL 的执行时间探查
为什么测量从入口函数生成的代码的执行时间。 - 生成执行时间探查数据
启用软件在环 (SIL) 或处理器在环 (PIL) 执行的执行时间探查。 - 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. - Investigate Execution-Time Issues Using PMU Metrics
Analyze code execution metrics from the Performance Monitoring Unit of the hardware.
内存使用量探查
- 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. - Stack Usage Profiling for Code Generated From MATLAB Code
Determine size of stack memory that is required to run generated code. - Preserve Unused Class Properties in Generated C/C++ Code
Preserve unused class properties or structure fields in the generated C/C++ code.
执行速度
- 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 from MATLAB Functions for Intel Platforms
Improve the execution speed of the generated code using Intel® SSE and Intel AVX technology. - Generate SIMD Code from MATLAB Functions for Apple silicon Platforms
Improve the execution speed of the generated code for Apple silicon platforms using ARM® Neon technology.