Main Content

代码分析和追溯

通过使用报告、可追溯性和 Polyspace® 静态代码分析产品来手动验证生成的代码和分析关键路径

生成代码后,请通过分析代码度量、接口、替换和代码生成假设,确保代码满足您的要求。代码生成报告会提供有关生成代码的这些方面的信息。您可以评估代码并修改模型,以生成满足您要求的代码。

要验证生成的代码,请使用代码追溯在代码行及其对应的模型元素之间导航。您可以从代码中的超链接追溯到模型元素,也可以从模型元素追溯到代码行。您还可以包含从生成的代码到模型元素要求的链接。

您还可以通过使用关键路径分析来分析生成的代码,以确定产生最长执行时间的执行路径。产生最长执行时间的路径称为关键路径。使用代码探查分析器来识别已标识路径中开销最大的部分,并对开销较大的部分执行优化以满足性能要求。

App

代码探查分析器Analyze execution-time and stack usage profiles for generated code (自 R2023a 起)

函数

rtwtraceTrace a block to generated code in code generation report
coder.profile.test.analyzePathIdentify critical paths of tasks (自 R2024a 起)
coder.profile.test.generateTestsGenerate decision coverage tests for execution-time analysis (自 R2024a 起)
coder.profile.test.generateCriticalPathTestGenerate tests for critical paths (自 R2024a 起)
coder.profile.test.getCriticalPathElementsGet cell array of model elements in critical path (自 R2024a 起)
coder.profile.test.hiliteCriticalPathHighlight critical path in model canvas (自 R2024a 起)

主题

代码分析

代码追溯

关键路径分析