Search code examples
matlabperformanceprogress

Tracking progress of MATLAB standard library functions


Some MATLAB functions (like the solvers), include options that allow for periodic logging of function progress. For instance, optimset for fminsearch. For other functions in the standard library, is there any way of benchmarking progress (or even continued execution in a serial setting)?

For instance, a call to zeros(N) with a sufficiently large N will take a long time. Other than repeatedly calling the function in a tic/toc sort of way to get a feel for the way the problem is scaling with different inputs for N, is there a way of assessing the progress of a function call? In general, is there a means of tracking the progress of a built-in function?


Solution

  • There is not a way to do exactly what you are asking in a running script or function by itself. You could add lots of tic/tocs & disp statements to track progress ... but that can be tedious.

    However, if your goal is to determine slow points & areas not scaling well then you should use Matlab's Profiler.

    Profiling is a way to measure where a program spends time. After you identify which functions are consuming the most time, you can evaluate them for possible performance improvements.

    Feed it you functions with larger & larger inputs & it will tell you where the slow spots are that need some work.