Main Content

Simulink Profiler

Analyze distribution of simulation execution time among model components


The Simulink Profiler runs a profiling simulation of your model and produces a report you can use to analyze the distribution of simulation execution time among model components. Analyzing the report can help you:

  • Determine whether a close investigation of one or more model components might yield performance improvements for your model

  • Decide which components to investigate first

In the profiling simulation, the Simulink Profiler measures the total execution time for the simulation and the execution time for each model component, including blocks, subsystems, and model references. When the execution time for a component is unexpected, you might be able to improve the simulation performance by modifying the component implementation. For example, when an S-Function block accounts for most of the execution time, optimizing the S-function code could speed up the simulation.

The Simulink Editor has the Simulink Profiler open for the model sldemo_antiwindup.

Open the Simulink Profiler

Simulink® Toolstrip: On the Debug tab, in the Performance section, click the Performance Advisor button arrow and select Simulink Profiler.


expand all

This example shows how to use the Simulink Profiler to track down the source of a simulation slowdown in your model.

This example uses a modified version of the sldemo_fuelsys_dd model, (the Modeling a Fault-Tolerant Fuel Control System example) model with a slowdown artificially inserted.

Open the profiler for your model from the Debug tab by selecting Performance Advisor > Simulink Profiler.

Click Profile to profile the model. When simulation completes, the Profiler Report pane opens.

Observe that the Engine Gas Dynamics block takes a large portion of the total profiling time (177.759s out of 231.443s) of the top model. This is a useful place to start looking for the problematic block in the model.

Recursively expand the block hierarchy view. By default, the profiler sorts the blocks at the same level of the model in descending order of Total Time(s).

Observe that the For Iterator subsystem accounts for approximately 98% of the execution time of the EGO Sensor subsystem. It is highly probable that this is the source of the slow performance of the model.

Delete the block, reconnect the broken signal, and profile the model again. You should see significantly faster simulation times.

To compare the results between the two runs, click Add Report Panel and select the previous run from the Run list.

You can share the results of a selected run as an HTML report or as a MAT file. To share the profiler report, from the Share menu, select Generate Report for an HTML report or Export to save the results in a MAT file. The profiling results are exported to the current working folder in MATLAB™.

To view the generated report, you can open it in a supported web browser or use the built-in browser by passing the file path to the web command. If you have MATLAB Report Generator™ installed, you can also use rptview to view the report.

See Also

Understanding Total Time and Self Time in Profiler Reports


  • When you want to analyze and improve simulation performance, consider starting the analysis by analyzing your model and simulation configuration using the Performance Advisor.

  • After analyzing the model and simulation configuration using the Performance Advisor, you can perform deeper analysis by profiling simulations using the Solver Profiler and the Simulink Profiler.

    • The Solver Profiler analyzes the performance of the selected solver for the model and can be particularly helpful for analyzing the performance of simulations that use variable-step solvers. The profiling results help you identify when and why the step size is limited.

    • The Simulink Profiler helps you identify bottlenecks for simulation performance by analyzing the distribution of simulation execution time among model components.

Version History

Introduced in R2007b

expand all