Main Content

Code Analysis and Tracing

Verify generated code manually by using reports, traceability, and Polyspace® static code analysis products and analyze critical paths

After you generate code, make sure that the code meets your requirements by analyzing the code metrics, interfaces, replacements, and code generation assumptions. The code generation report provides information about these aspects of the generated code. You can assess the code and modify your model to generate code that meets your requirements.

Verify the generated code by navigating between a line of code and its corresponding model elements by using code tracing. You can trace from hyperlinks in the code to model elements and from model elements to code lines. You can also include links from the generated code to the model element requirements.

You can also analyze the generated code to identify the execution paths that produce the longest execution-times by using critical path analysis. The paths that produce the longest execution-times are called critical paths. Use the Code Profile Analyzer to identify the most expensive sections of the identified paths and apply optimization efforts on the expensive sections to meet your performance requirements.

Apps

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

Functions

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

Topics

Code Analysis

Code Tracing

Critical Path Analysis

Featured Examples