简体   繁体   中英

Matlab profiling

I'm trying to speed up my code in Matlab through profiling. I have two questions:

1) when I call the profile report I get a list of functions; most of them are not explicitly called by my code (eg workspacefunc ); how can I see to which lines of my code they are referred?

2) What is the function workspacefunc ?

If you do anything else between profile on and profile viewer except run the code you're trying to check, other actions you take will also be included in the profiler.

For example, running the standard example:

profile on
plot(magic(35))
profile viewer

Should show you that most of the time is actually consumed by setdiff (if ordered by Self Time). workspacefunc is not listed.

If after calling plot(magic(35)) , you then go to the plot and zoom in a bit, then call profile viewer , you will see that some functions related to zoom are now in the list. The code itself, of course, doesn't actually zoom anything.

And if after calling plot(magic(35)) , you double-click on a variable in the Workspace browser, then run profile viewer , you will see workspacefunc , and a bunch of other things which weren't there before, appear in the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM