Skip to Main Content Skip to Search
Product Documentation

cputime - Elapsed CPU time

Syntax

cputime

Description

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.

Tips

Although it is possible to measure performance using the cputime function, it is recommended that you use the tic and toc functions for this purpose exclusively. See Using tic and toc Versus the cputime Function in the MATLAB Programming Fundamentals documentation for more information.

Examples

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

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

e =
     0.4667 

See Also

clock | etime | tic | toc

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS