Elapsed CPU time
cputime
cputime
returns 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.
The following code returns the CPU time used to run surf(peaks(40))
.
t = cputime; surf(peaks(40)); e = cputime-t e = 0.4667
To measure performance, it is recommended that you use the timeit
or tic
and toc
functions. For more information,
see Using tic and toc Versus
the cputime Function.