MATLAB Function Reference | Search  Help Desk |
profile | See Also |
Measure and display M-file execution profiles
profile function
profile report
profile report n
profile report frac
profile on
profile off
profile done
profile reset
info = profile
The profiler utility helps you debug and optimize M-files by tracking the cumulative execution time of each line of code. The utility creates a vector of "bins," one bin for every line of code in the M-file being profiled. As MATLAB executes the M-file code, the profiler updates each bin with running counts of the time spent executing the corresponding line.
profile function
starts the profiler for function
. function
must be the name of an M-file function or a MATLABPATH
relative partial pathname.
profile report
displays a profile summary report for the M-file currently being profiled.
profile report n,
where n
is an integer, displays a report showing the n
lines that take the most time.
profile report frac,
where frac
is a number between 0.0 and 1.0, displays a report of each line that accounts for more than frac
of the total time.
profile on
and profile off
enable and disable profiling, respectively.
profile done
turns off the profiler and clears its data.
profile reset
erases the bin contents without disabling profiling or changing the M-file under inspection.
info = profile
returns a structure with the fields:set
and get
commands. See the Applying MATLAB for more details.
The profiler utility can accommodate only one M-file at a time.
See also partialpath
.