Main Content

executioninfo

Retrieve execution coverage information from cvdata object

Description

covInfo = executioninfo(cvdo,modelObject) returns execution coverage results from the cvdata object cvdo for the model component specified by object.

covInfo = executioninfo(cvdo,modelObject,simMode) returns execution coverage results from the cvdata object cvdo for the model component specified by object for the simulation mode mode.

covInfo = executioninfo(cvdo,modelObject,ignore_descendants) returns execution coverage results for object, depending on the value of ignore_descendants.

example

[covInfo,description] = executioninfo(cvdo,modelObject) returns execution coverage results and text descriptions of execution points associated with object.

Examples

collapse all

Open the slvnvdemo_cv_small_controller model and create the test specification object testObj. Enable execution coverage for slvnvdemo_cv_small_controller and execute testObj using cvsim. Use executioninfo to retrieve the execution coverage results for the Saturation block and determine the percentage of execution outcomes covered:

mdl = 'slvnvdemo_cv_small_controller';
open_system(mdl)
testObj = cvtest(mdl)
data = cvsim(testObj)
blk_handle = get_param([mdl, '/Saturation'], 'Handle');
cov = executioninfo(data, blk_handle)
percent_cov = 100 * cov(1) / cov(2)

Input Arguments

collapse all

Coverage data, specified as a cvdata object.

Data Types: cvdata

Model object, specified as a character array, string array, Simulink handle, Stateflow ID, or cell array.

To specify a model object, for example a block or a Stateflow chart, use one of the following formats:

Object SpecificationDescription

BlockPath

Full path to a model or block

BlockHandle

Handle to a model or block

slObj

Handle to a Simulink API object

sfID

Stateflow ID

sfObj

Handle to a Stateflow API object from a singly instantiated Stateflow chart

{BlockPath, sfID}

Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

{BlockPath, sfObj}

Cell array with the path to a Stateflow chart or subchart and a Stateflow object API handle contained in that chart or subchart

{BlockHandle, sfID}

Cell array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

To specify an S-Function block or its contents, use one of the following formats:

Object SpecificationDescription

{BlockPath, fName}

Cell array with the path to an S-Function block and the name of a source file

{BlockHandle, fName}

Cell array with an S-Function block handle and the name of a source file

{BlockPath, fName, funName}

Cell array with the path to an S-Function block, the name of a source file, and a function name

{BlockHandle, fName, funName}

Cell array with an S-Function block handle, the name of a source file an a function name

To specify a code coverage result, for example coverage data collected during software-in-the-loop (SIL) or processor-in-the-loop (PIL) analysis, use one of the following formats:

Object SpecificationDescription

{fileName, funName}

Cell array with the name of a source file and a function name

{Model, fileName}

Cell array with a model name or model handle and the name of a source file

{Model, fileName, funName}

Cell array with a model name or model handle, the name of a source file, and a function name

Data Types: char | string | cell | Stateflow.State | Stateflow.Transition

Simulation mode during coverage analysis, specified as one of the following:

Object SpecificationDescription

'Normal'

Model in normal simulation mode.

'SIL' (or 'PIL')

Model in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode.

'ModelRefSIL' (or 'ModelRefPIL')

Model reference in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode.

'ModelRefTopSIL' (or 'ModelRefTopPIL')

Model reference in software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode with the code interface set to top model.

Data Types: char | string

Whether to ignore descendants in coverage results, specified as 0 or 1, where:

  • 0 includes coverage results of descendant objects.

  • 1 ignores coverage results of descendant objects.

Data Types: single | double

Output Arguments

collapse all

Coverage information, returned as a two-element array of the form [covered_outcomes,total_outcomes] if cvdo contains execution coverage data, or an empty array if it does not.

covered_outcomesNumber of execution outcomes satisfied for object
total_outcomesNumber of execution outcomes for object

Data Types: double

Execution coverage description, returned as a structure with the following fields:

Block exclusion flag, returned as 1 if the block is excluded and 0 if it is not.

Data Types: double

Block coverage filter rationale, returned as a character array.

Data Types: char

Number of justified coverage objective outcomes, returned as a scalar double.

Data Types: double

Block justification flag, returned as 1 if the block is justified or 0 if it is not.

Data Types: double

Information for individual decisions, returned as a structure array with the following fields:

Block execution text, returned as the character array 'Block executed'. The text field does not change even if the block has 0% execution coverage.

Data Types: char

Number of time steps the model object executed, returned as a scalar double.

Data Types: double

Data Types: struct

Alternatives

Use the coverage settings to collect and display execution coverage results:

  1. Open the model.

  2. In the Model Editor, select Model Settings on the Modeling tab.

  3. On the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis.

  4. Under Coverage metrics, select Block Execution as the structural coverage level.

  5. Click OK to close the Configuration Parameters dialog box and save your changes.

  6. Simulate the model by clicking the Run button and review the results.

Version History

Introduced in R2006b