Why does the Profiler show substantially different results for the same code?

I want to use the profiler "bar map" at the top to show students how to use and analyze code using the profiler in MATLAB R2020a
-A single click only shows non-built in function in the bar map.
-A double click shows built in and non-built in functions sometimes, and sometimes only non-built in functions.
Why do I see this behavior, and how can I make it more consistent?

 Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 10 de Abr. de 2020
Editada: MathWorks Support Team el 19 de Mayo de 2020
When you profile the code from the profiler window, it captures all the code that runs there. This can be different code from what is running when using the MATLAB Command Window.
If you click too quickly, you could restart profiling while MATLAB was still working on cleaning up the workspace. I was able to reproduce this behavior - showing extra information - when rapidly clicking the 'Run and Time' profiling button.
As a workaround, single clicking should show consistent profiling results. Alternatively, hitting "Enter" from the text input where the script name is should also avoid double execution.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by