Main Content


Identify critical paths of tasks

Since R2024a



resultsObject = coder.profile.test.analyzePath(modelName, SimMode="SIL") collects execution-time metrics for tasks through a software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation using the model inputs. Then, it analyzes the metrics and identifies the code execution paths of the tasks that take the longest measured execution times, which are the critical paths.

The function stores the results in the resultsObject object. The results include:

  • Identified critical paths.

  • Estimated cost percentages of code sections in the identified paths.

Use Code Profile Analyzer to analyze the results in resultsObject.

resultsObject= coder.profile.test.analyzePath(modelName, TestFile="myTestFile") uses the model's SIL/PIL Mode and test cases in the Simulink® Test™ file myTestFile for the analysis.

resultsObject= coder.profile.test.analyzePath(..., Name=Value) specifies additional name-value arguments.


collapse all

You can use coder.profile.test.analyzePath and the Code Profile Analyzer to identify critical paths of the generated tasks and performance bottlenecks in them.

Input Arguments

collapse all

Name of the model, specified as a character vector or string.

Example: "myModel"

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: resultsObject = coder.profile.test.analyzePath("myModel",SimMode="SIL")

Types of instrumentation approach for the analysis:

  • "FineGrained": Instruments each decision branch.

  • "CoarseGrained": Instruments tasks.

Example: resultsObject = coder.profile.test.analyzePath("myModel",InstrumentationMode="CoarseGrained", SimMode="SIL")

Data Types: char | string

TestFile specifies the path to the MLDATX test file. When you specify the path to the test file, the coder.profile.test.analyzePath function uses the model's SIL/PIL Mode and the test cases in the file for the analysis. If you want to specify the simulation mode, set a value for SimMode.

Example: resultsObject = coder.profile.test.analyzePath("myModel",TestFile="New Folder\taprj\sldv_output\mymodel\mymodel_test.mldatx")

Data Types: char | string

Simulation mode specified as SIL or PIL. If you want to use model inputs for the analysis, you must specify a simulation mode.

Example: resultsObject = coder.profile.test.analyzePath("myModel", SimMode="SIL")

Data Types: char | string

When you set Verbose to true, the function displays diagnostic messages after each step of the analysis in the MATLAB Command Window. If the function encounters errors, it generates a PDF file in your working directory providing information on the root cause of the errors.

Example: resultsObject = coder.profile.test.analyzePath("myModel",SimMode="SIL",Verbose=true)

Data Types: logical

Output Arguments

collapse all

This object stores the identified critical paths and estimated cost percentages of code sections in the identified paths.

Use Code Profile Analyzer to analyze the results. To get a cell array of model elements in the identified critical path, use the function.

Version History

Introduced in R2024a