Documentation

cputime

Elapsed CPU time

Syntax

cputime

Description

cputimereturns the total CPU time (in seconds) used by your MATLAB®application from the time it was started. This number can overflow the internal representation and wrap around.

Examples

The following code returns the CPU time used to runsurf(peaks(40)).

t = cputime; surf(peaks(40)); e = cputime-t e = 0.4667

Tips

To measure performance, it is recommended that you use thetimeitorticandtocfunctions. For more information, seeUsing tic and toc Versus the cputime Function.

See Also

||||

Introduced before R2006a

Was this topic helpful?