main content

analyze distribution of simulation execution time among model components -凯发k8网页登录

analyze distribution of simulation execution time among model components

description

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.

open the simulink profiler

simulink® toolstrip: on the debug tab, in the performance section, click the performance advisor button arrow and select simulink profiler.

examples

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

tips

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

  • 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

see also

tools

objects

  • | |

topics

    网站地图