Type of profiling
R2026bProfile one of code coverage, execution time, or memory use
Since R2023b
Description
Specify whether you want to calculate the code coverage metrics, the execution time, or the memory use. Based on your selection, Polyspace® Test™ instruments the source code.
Set Option
Set the option using one of these methods:
Polyspace Platform user interface (desktop products only): Select this option on the Profiling section of the Polyspace Platform toolstrip.
Command line: See Command-Line Information.
Why Use This Option
Profiling code coverage helps you determine whether your test cases cover the execution paths of your code adequately.
Profiling execution time helps you identify functions and other callable entities that introduce bottlenecks in your code.
Profiling memory use helps you identify functions or other callable entities that consume an unexpected amount of stack memory.
Use this option to specify your desired profiling option. You can select one of the three at a time.
Settings
No ProfilingDisables profiling.
Code CoverageEnables the calculation of code coverage metrics.
See also Calculate C/C++ Code Profiling Metrics in Polyspace Platform User Interface.
Execution TimeEnables the calculation of the execution time of the various functions and other callable entities in your code.
See also Calculate Execution Time of Functions in C/C++ Code.
Memory UseEnables the calculation of the stack use of the various functions and other callable entities in your code.
SanitizerEnables detection of numeric, memory management, and other errors during test execution.
See also Run C/C++ Code Sanitizer and Review Results in Polyspace Platform User Interface.
Dependencies
At the command line, if you use -exec-metric-level or -stack-metric-level, you must a provide a value as the input to prof-counter-size.
Command-Line Information
At the command line you can select a type of profiling by using either the polyspace-code-profiler command or the polyspace-test command. If you have a *.psprjx project, use the polyspace-test command. If you are profiling xUnit tests, use the polyspace-code-profiler command.
polyspace-code-profiler
Parameter: -cov-metric-level |
Value: none | statement | decision | condition/decision | mcdc |
Example (code coverage): polyspace-code-profiler -instrument -instrum-dir |
Parameter: -exec-metric-level |
Value: none | minimal | standard | detailed |
Example (execution time):
polyspace-code-profiler -instrument -instrum-dir |
Parameter: -stack-metric-level |
Value: none | minimal | standard | detailed |
Example (memory use):
polyspace-code-profiler -instrument -instrum-dir |
polyspace-test
Parameter: -profiling-mode |
Value: none | coverage | execution-profile | stack-profile |
Example (code coverage):
polyspace-test -run -project |
Example (execution time):
polyspace-test -run -project |
Example (memory use):
polyspace-test -run -project |
Version History
Introduced in R2023b
See Also
polyspace-code-profiler | polyspace-test -build | polyspace-test -run
Topics
- Configure Project for Testing in Polyspace Platform User Interface
- Calculate C/C++ Code Profiling Metrics in Polyspace Platform User Interface
- Calculate Execution Time of Functions in C/C++ Code
- Calculate Memory Use of Functions in C/C++ Code
- Run C/C++ Code Sanitizer and Review Results in Polyspace Platform User Interface