Set or check a wall-clock timer.
tic without an output argument sets the internal timer state.
Subsequent calls to
toc return the number of seconds since the timer
tic (); # many computations later… elapsed_time = toc ();
will set the variable
elapsed_time to the number of seconds since
the most recent call to the function
If called with one output argument,
tic returns a scalar
uint64 that may be later passed to
id = tic; pause (5); toc (id) ⇒ 5.0010
toc this way allows nested timing calls.
If you are more interested in the CPU time that your process used, you
should use the
cputime function instead. The
toc functions report the actual wall clock time that elapsed
between the calls. This may include time spent processing other jobs or
doing nothing at all.
See also: toc, cputime.