Measure compile time and run time separately in Simulink

조회 수: 14 (최근 30일)
Horace
Horace 2012년 9월 10일
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

답변 (4개)

Andreas Goser
Andreas Goser 2012년 9월 10일
편집: Andreas Goser 2012년 9월 10일
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
Kaustubha Govind 2012년 9월 10일
편집: Kaustubha Govind 2012년 9월 10일
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
Kaustubha Govind
Kaustubha Govind 2012년 9월 17일
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
Samir 2012년 9월 19일
Thanks Kaustubha.

댓글을 달려면 로그인하십시오.


Horace
Horace 2012년 9월 10일
By compile time, I mean this:
When I click run on simulink, there is a green loading bar. Once the green loading bar is done, the bar turns blue and runs the simulation for the time specified. How do I measure the time used for hte green bar and the blue bar separately?
Thanks, Horace

Horace
Horace 2012년 9월 10일
Thanks for the help Kaustubha.
It was exactly what I was looking for. But is there a way to do this without hte profiler? The reason I ask is because the Profiler really slows down the compilation and simulation.
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2012년 9월 10일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by