socModelAnalyzer

Estimate number of operations in Simulink model

Description

example

socModelAnalyzer(modelName) generates a report with the estimated number of operations in a Simulink® model specified by modelName.

The function generates the report as a Microsoft® Excel® spreadsheet and a MAT-file. The function also provides a link to view the report in a separate dialog box.

The report includes information for each mathematical or logical operator in the function, with individual lines for each operator and data type. For example, multiplication with data type double and multiplication with data type uint32 are listed separately. The report lists each instance of the operator as a separate line. The report includes these fields.

  • Path – The path to the operator within the structural hierarchy of the top function

  • Count – The number of times the operator is executed in the design

  • Operator – The operator used

  • DataType – The data type used for the output of the operator

  • Link – A link to the location of the operator in the function

For more information, see Using the Algorithm Analyzer Report.

example

socModelAnalyzer(modelName,Name,Value) specifies options using one or more name-value pair arguments. For example, 'IncludeOperator','+' specifies that the generated report only includes '+' operator counts.

example

report = socModelAnalyzer(___) returns a structure of tables that contain report information. Specify any of the input argument combinations from previous syntaxes.

Examples

collapse all

Calculate the number of operators in the model testmdl.slx.

Analyze the Model

Count operators in testmdl, and generate a report in a folder named report.

socModelAnalyzer('testmdl.slx',"Folder","report");

View the Generated Report

After execution, the socModelAnalyzer function provides a link to the generated report. Click the link titled Open report viewer. The report opens in a separate window:

The result shows that the ADD operator is used 11 times with data type matrix 10 uint32, and 22 times with data type uint32. The GT (greater than) operator was used 22 times total with data type logical: 11 times from SubAdd model, and 11 times from SubMult model. The MUL operator is used 11 times with data type uint32, and 11 times with matrix 10 uint32.

Input Arguments

collapse all

Simulink model to analyze, specified as a character vector or string scalar.

Example: 'soc_analyze_FFT_top.slx'

Data Types: char | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: socModelAnalyzer('mySocModel.slx','Folder','report_sym')

Folder location of generated report, specified as the comma-separated pair consisting of 'Folder' and a character vector or string scalar indicating the folder path. Specify the path to the location for the generated output reports as a full path or relative path.

Example: 'Folder','C:/Work/mydir'

Operators to include in the generated report , specified as the comma-separated pair consisting of 'IncludeOperator' and a character vector or string scalar to specify one operator. Use cell array of character vectors or string scalars to specify multiple operators. When you do not specify this name-value pair argument, the socModelAnalyzer function includes all operators, except for the operators specified by the ExcludeOperator name-value pair argument.

Example: 'IncludeOperator','+'

Example: 'IncludeOperator',{'+','IF','MUL'}

Operators to exclude from the generated report, specified as the comma-separated pair consisting of 'ExcludeOperator' and a character vector or string scalar to specify one operator. Use cell array of character vectors or string scalars to specify multiple operators. When you do not specify this name-value pair argument, the socModelAnalyzer function includes all operators in the report.

Example: 'ExcludeOperator','-'

Example: 'ExcludeOperator',{'-','CALL'}

Models or blocks to include in generated report, specified as the comma-separated pair consisting of 'IncludeBlockPath' and a character vector or string scalar to specify one block or model. Use cell array of character vectors or string scalars to specify multiple blocks or models. If you do not specify this name-value pair argument, the socModelAnalyzer function includes all models and blocks in the report, except for the blocks specified by the 'ExcludeBlockPath' name-value pair argument. Use the 'IncludeBlockPath' name-value pair when you have a test bench model, and you only want to analyze one of the models it includes.

Example: 'IncludeBlockPath','myModel.slx'

Example: 'IncludeBlockPath',{'myModel.slx','myIfft'}

Models or blocks to include in generated report, specified as the comma-separated pair consisting of 'ExcludeBlockPath' and a character vector or string scalar to specify one block or model. Use cell array of character vectors or string scalars to specify multiple blocks or models. If you do not specify this name-value pair argument, the socModelAnalyzer function includes all models and blocks in the report.

Example: 'ExcludeBlockPath','myOtherModel.slx'

Example: 'ExcludeBlockPath',{'myOtherModel.slx','myIfft'}

Display verbose messages, specified as the comma-separated pair consisting of 'Verbose' and 0 (false) or 1 (true). When this value is 1 (true), the function displays detailed information during the different stages of execution.

Example: 'Verbose',true

Output Arguments

collapse all

Model operator count, returned as a structure of five tables:

  • OperatorDetailedReport – A fully detailed report per operator

  • OperatorAggregatedReport – An aggregated operator view, with one line for each type of operator

  • OperatorHierarchicalReport – A hierarchical operator view

  • PathAggregatedReport – An aggregated model view

  • PathHierarchicalReport – A Hierarchical model view

Each table contains raw data from which the function generates an HTML view, and a link to view the data in a report window. The generated Excel file has five sheets, containing the information from the five tables. For more information about the generated report, see Using the Algorithm Analyzer Report.

Limitations

  • This function does not support AUTOSAR Blockset blocks or models.

  • This function does not support Simulink send and receive messages.

Introduced in R2020a