[ top | up ]
CPU time used
Syntax
unix.time(expr)
Arguments
expr
|
Valid R expression to be ``timed''
|
Description
unix.time calls the builtin proc.time, evaluates
expr, and the calls proc.time once more, returning the
difference to between the proc.time calls.
The values returned by the proc.time are (currently)
those returned by the C library function times(3v).
Value
A numeric vector of length 5 containing the cpu, user, total,
subproc1, subproc2 times.
See Also
proc.time, date, time which is for
time-series.
Examples
unix.time(for(i in 1:50) mad(runif(500)))
exT <- function(n = 100)
{
## Purpose: Test if unix.time works ok; n: loop size
unix.time(for(i in 1:n) x <- mean(rt(1000, df=4)))
}
##-- Try to interrupt one of the following (using Ctrl-C):
exT() #- '1.4' on -O-optimized Ultra1
unix.time(exT()) #~ +/- same