MATLAB Function Reference
  Go to function:
    Search    Help Desk 
profile    See Also

Measure and display M-file execution profiles

Syntax

Description

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:

file
Full path to the function being profiled.
function
Name of function being profiled.
interval
Sampling interval in seconds.
count
Vector of sample counts
state
on if the profiler is running and off otherwise.

Remarks

You can also profile built-in functions. The profiler tracks the number of intervals in which the built-in function was called (an estimate of how much time was spent executing the built-in function).

The profiler's behavior is defined by root object properties and can be manipulated using the set and get commands. See the Applying MATLAB for more details.

Limitations

The profiler utility can accommodate only one M-file at a time.

See Also

See also partialpath.



[ Previous | Help Desk | Next ]