Main Content

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 identifier DataSegmentEstimate.

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.

  • 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 weighted 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.

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 identifier OperatorCount.

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.

  • 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.

See Also

|

Related Topics