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

1 view (last 30 days)
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.
  3 Comments
Pan Zhao
Pan Zhao on 17 Aug 2017
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.
Allan Watson
Allan Watson on 3 Oct 2019
I have the same question/observation. In 2015b, I have been using profiler to investigate some performance issues. When I have profiler active, my entire real-world time is about 3 minutes. But profiler Total Time (using both -Timer performance and -Timer cpu) is listed as 7500 seconds. Even though profiler does slow things down, this is a factor of about 37.5 from reported time to clock time. I don't think it's even multithreading factors, because I don't have that many cores.
That said, I can use the values to measure relative improvements, even if the absolute numbers don't make sense.

Sign in to comment.

Answers (1)

Aveek Podder
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.

Categories

Find more on Reporting and Database Access in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!