Get elapsed CPU time
Double_Type toc ()
The toc function returns the elapsed CPU time in seconds since the last call to tic. The CPU time is the amount of time the CPU spent running the code of the current process.
The tic and toc functions are ideal for timing the execution of the interpreter:
variable a = "hello", b = "world", c, n = 100000, t; tic (); loop (n) c = a + b; t = toc (); vmessage ("a+b took %f seconds\n", t); tic (); loop (n) c = strcat(a,b); t = toc (); vmessage ("strcat took %f seconds\n", t);
This function may not be available on all systems.
The implementation of this function is based upon the times system call. The precision of the clock is system dependent.
The Chandra X-Ray
Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA. Email: firstname.lastname@example.org
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.