MATLAB Answers

0

Why is the recorded time of a Simulink model by the Profiler so different from that from a stopwatch?

Asked by Pan Zhao on 16 Aug 2017
Latest activity Edited by Pan Zhao on 23 Aug 2017
I have a Simulink model containing several Matlab Functions. When I use the Profiler (enabled through Analysis> Performance Tools > Show profiler report) to analyse the execution time of the model, the profiler always gave a total recorded time of 530~550 seconds. However, the execution time recorded by a stopwatch was definitely below 100 seconds. I cannot understand why there is so much discrepancy between the time given by the Profiler and that by a stopwatch. I am not sure whether this is related to the Matlab Functions in my model.
Any comment is greatly appreciated.

  2 Comments

Hi Pan,
The discrepancy here is likely because of the overhead of the Profiler. Because it does more than just time, frequently when running with profiling enabled, the same function(s) can take significantly longer.
Hi aborghes,
Thanks for your reply. But I am still confused. Is the time displayed in Profiler report the real execution time? If so, I believe it should be approximately the same as the time given by a stop watch or the Matlab tic/toc command. However, this is not the case I experienced.

Sign in to comment.

1 Answer

Answer by Aveek Podder on 23 Aug 2017

Hi,
I understand that you want to measure the real execution time of your Simulink model. Profiler is an overhead function which run in the background and it collects the execution time. This make the system slow and thus the profile time is more.
"tic-toc" gives the actual execution time of the Simulation.

  0 Comments

Sign in to comment.