Analze running time of simulation

3 visualizzazioni (ultimi 30 giorni)
Max
Max il 23 Ago 2017
Risposto: Eeshan Mitra il 25 Ago 2017
Hi,
I'd like to analyze the running time of my simulink model without time for compiling.
My understanding is, if I use
tic
sim(modelName)
toc
the compiling time is measured as well.
Another idea could be the profiler? But then my Simulation gets very slow, so I'm not sure, whether this result is correct.
Has anybody a idea?
Thanks in advance.

Risposte (1)

Eeshan Mitra
Eeshan Mitra il 25 Ago 2017
Simulink Profiler adds some overheads in the background to the functions or models being profiled. Since it gives the detailed execution time for each function during simulation, it is the best way to judge the performance of just the "simulation phase".
However, if you do not want to recompile your Simulink model, say for different iterations, consider using the "Fast Restart" option with "tic-toc". Find more information about the "Fast Restart" option in the following link:
Consider the simulation of the model "vdp" with a MATLAB script:
for i=1:4
tic
sim('vdp','FastRestart','on');
toc
end
The first run of the model involves compilation, but not the three subsequent ones. The timing adheres more to the "simulation phase" in the last three simulations.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by