Measure compile time and run time separately in Simulink
Afficher commentaires plus anciens
Hi,
I would like to measure compile time and run time separately in Simulink. If I use tic; sim('model.mdl'); toc, then I get hte total time of compiling the model and running the model. But how can I get those times separately?
Thanks, Horace
1 commentaire
Azzi Abdelmalek
le 10 Sep 2012
are you using code generation?
Réponses (4)
Andreas Goser
le 10 Sep 2012
Modifié(e) : Andreas Goser
le 10 Sep 2012
It is not fully clear to me what "compiler time" is in your context. There are multiple reasons why Simulink models need time before the simulation starts. You may look for something like the SLBUILD and RTWBUILD commands. You can measure this time and then the pure simulation time. You may also be interested in measuring the time for "update diagram". The command her would be
set_param('sys', 'SimulationCommand', 'update');
Kaustubha Govind
le 10 Sep 2012
Modifié(e) : Kaustubha Govind
le 10 Sep 2012
1 vote
Try using the Simulink Profiler - I think the stage corresponding to ModelInitialize() is the compiler-phase and ModelExecute() is the run-time phase. Note that the Profiler adds instrumentation which introduces some overhead to your simulation, so the total execution time for your model will be slower that using tic-toc.
3 commentaires
Samir
le 13 Sep 2012
Hello Kaustubha,
I tried to open the Simulink Profiler but it says, it does not exist. Is there any other link for Simulink Profiler.
Kaustubha Govind
le 17 Sep 2012
Samir: Sorry, I think they revamped the documentation with the latest release, so the link has changed. Try http://www.mathworks.com/help/simulink/ug/capturing-performance-data.html
Samir
le 19 Sep 2012
Thanks Kaustubha.
Horace
le 10 Sep 2012
0 votes
Horace
le 10 Sep 2012
0 votes
1 commentaire
Kaustubha Govind
le 10 Sep 2012
Horace: Sorry, I don't know of a faster way to get this information. You could try Andreas suggestion of running "tic;set_param('model', 'SimulationCommand', 'update');toc" to get just the compilation time, and subtract it from "tic; sim('model'); toc" to get the execution time.
Catégories
En savoir plus sur Simulink dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!