Next: getusage()
Up: MacAnova Help File
Previous: getseeds()
Contents
Usage:
gettime(), gettime(quiet:T), or gettime(keep:T [,quiet:F])
gettime(interval:T), gettime(interval:T,quiet:T), or
gettime(interval:T,keep:T [,quiet:F])
|
Keywords:
general
gettime() prints the time in seconds since the start of the run.
gettime(interval:T) prints the time in seconds since the last time
gettime() was used (since the start if this is the first usage).
gettime(quiet:T) and gettime(interval:T, quiet:T) do nothing but save
the current time for the next time gettime(interval:T) is used.
gettime(keep:T [, quiet:F]) returns the time since start as a REAL
scalar. It prints nothing unless quiet:F is an argument.
gettime(interval:T, keep:T [, quiet:F]) returns the time since last use
as a REAL scalar. It prints nothing unless quiet:F is an argument.
You can create a macro that will print the elapsed time of an action by
Cmd> timeit <- macro("gettime(quiet:T);{$0};gettime(interval:T)")
Then, for example,
Cmd> timeit(x <- rnorm(1000);stuff <- describe(x))
will print time spent generating x and computing descriptive statistics.
See also topics macro(), 'macros'.
On most computers, gettime() returns the actual time elapsed as might be
measured with a stop watch. On a few computers, the time is the amount
of central processor time used. This will generally be less, often much
less than the actual elapsed time.
Examples:
Cmd> gettime()
Time since start is 377.65 seconds.
Cmd> gettime(quiet:T);mymacro(x,y);gettime(interval:T)
Elapsed time is 3.6718 seconds
Cmd> gettime(quiet:T);mymacro(x,y);gettime(interval:T,keep:T)
(1) 3.699
Cmd> gettime(quiet:T);mymacro(x,y);gettime(interval:T,keep:T,quiet:F)
Elapsed time is 3.6523 seconds
(1) 3.6523
Gary Oehlert
2003-01-15