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.
|