Main Content

Collect Design Cost Metrics

Collect metric data on cost of implementing design in embedded C code

Use design cost metrics to estimate the cost of implementing your Simulink® design in embedded C code. Design cost metrics analyze your model and report detailed cost data that can be traced back to the blocks in the Simulink model.

Use metric.Engine to collect metric data on the memory usage of one or more design units in a project. Analyze design cost using these metrics:

  • Data segment estimate — 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 used 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.

  • Operator count — Use a count of operators in the generated code to estimate the size of your program. 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.

You can use design cost metrics to identify cost bottlenecks, compare multiple design alternatives in a trade study, or track design growth following a change.

Classes

metric.EngineCollect metric data on models (Since R2022a)
metric.ResultMetric data for specified metric algorithm (Since R2022a)

Topics