profile_history analyzes the latest profiling session and displays the function-call timings and durations in a graphical timeline. The function labels and timeline bars are clickable, linking to their respective detailed profiling report (of the builtin Matlab profiler).
profile_history(profData) displays the timeline of a specific profiling session, that was previously stored via a profData=profile('info') command.
profile_history(initialDetail) or profile_history(profData,initialDetail) displays the timeline showing an initial detail level of a specified number of functions (default initialDetail=15). The detail level can then be changed interactively, using a slider at the bottom of the figure.
profile on; myProgram(); profile_history
profile on; myProgram(); profData=profile('info'); profile_history(profData)
profile_history uses a wrapper function for the built-in profile.m that is located in the @char subfolder. If for some reason you see problems when running the profiler, simply delete the @char folder. In order to be able to use profile_history after you delete the @char folder, add the -timestamp parameter whenever you profile:
profile on -timestamp; myProgram(); profile_history
(adding the -timestamp parameter is not needed when the @char exists)
This utility relies on the undocumented and unsupported profiler timestamp history functionality, as described in http://UndocumentedMatlab.com/blog/undocumented-profiler-options-part-3#detailed .
It works on all the recent Matlab releases (inc. R2014a), but might stop working in any future Matlab release without prior notice.
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
I just uploaded a new version that contains programmatic and interactive control of the display detail level (default = top 15 functions, sorted by total time).
Guys, I'm thinking of adding more controls over the level of detail. In the meantime, try unchecking some of the checkboxes at the bottom of the figure to make it less cluttered, and/or to use the figure's zoom and pan features to explore a subset of the profiling timeline.
As noted, additional capabilities to make exploration easier will be added in due course.
I agree with Dan, I was hoping to use this to profile a large code base that I'm unfamiliar with, but the figure becomes completely packed and if you try to zoom in, the cursor becomes very jumpy. In this use case I don't care about timing at all, just trying to get a visual representation of the function stack flow, maybe there could be an option to make it work better in this use case?
One thing that I would like to see is a way to trim the depth of profile that is displayed. What I am finding is that if I try to use profile history on any function that includes a moderately complex GUI it gets pretty bogged down in the number of modules its displays. Otherwise, great work.
Fix for R2010a
Fixed bug in case of few profiled functions (checkbox didn't work)
minor title typo fix
Added initialDetail input arg and interactive detail-control functionality
External tick marks; fixed wrapper function eddge-case as per user feedback
Fix the previous update...
Fixes for HG2; fix info-box alignment near figure's right edge