Design Cost Model Metrics
Learn about design cost metrics that return metric data on the cost of implementing your Simulink® design in embedded C code.
Data Segment Estimate
Metric ID:
DataSegmentEstimate
Estimate the memory consumed by the data segment of generated code.
Description
Use this metric to estimate the amount of memory consumed, in bytes, by the data segment of code generated for the specified model unit. A data segment is a part of an object file or the corresponding address space of a program that holds initialized global variables and static local variables created during code generation. The size of the data segment is determined by the size of the values in the source code and does not change at run time.
To collect data for this metric:
Use
getMetrics
with the metric identifierDataSegmentEstimate
.
Collecting data for this metric requires a Fixed-Point Designer™ license.
Results
For this metric, instances of metric.Result
return
Value
as an integer representing the total cost of the design in
bytes. For a detailed breakdown of results, use the generateReport
function.
Capabilities and Limitations
The metric:
Analyzes one or more design units in a project, where a design unit represents a standalone Simulink or an entire model reference hierarchy.
Requires that when the
execute
function specifies an'ArtifactScope'
, thenscope
must refer to a top-level Simulink model.Metrics are collected only for designs that are code generation ready. If you collect metrics for a model reference hierarchy, each design within the hierarchy, including the top-level model, must be ready for code generation. Models that are not code generation ready will be ignored during metric execution and produce an error. You can use the
getArtifactErrors
function to see errors that occur during metric execution.
See Also
For an example of collecting metrics programmatically, see How to Collect Design Cost Metrics.
Operator Count
Metric ID: OperatorCount
Estimate the size of a design based on a count of operators used in generated code. This metric is an abstraction of the actual size of generated code and is returned as a unitless value. You can use this metric as an indicator of the complexity of model elements and how each element in the model will use available resources. This metric can be an early identifier of model changes that result in an unexpected increase in complexity.
Description
Use this metric to estimate the size of generated code for the specified design unit or model reference hierarchy.
To collect data for this metric:
Use
getMetrics
with the metric identifierOperatorCount
.
Collecting data for this metric requires a Fixed-Point Designer license.
Results
For this metric, instances of metric.Result
return
Value
as an integer representing the total cost of the design. For a
detailed breakdown of results, use the generateReport
function.
Capabilities and Limitations
The metric:
Analyzes one or more design units in a project, where a design unit represents a standalone Simulink or an entire model reference hierarchy.
Requires that when the
execute
function specifies an'ArtifactScope'
, thenscope
must refer to a top-level Simulink model.Metrics are collected only for designs that are code generation ready. If you collect metrics for a model reference hierarchy, each design within the hierarchy, including the top-level model, must be ready for code generation. Models that are not code generation ready will be ignored during metric execution and produce an error. You can use the
getArtifactErrors
function to see errors that occur during metric execution.
See Also
For an example of collecting metrics programmatically, see How to Collect Design Cost Metrics.