system.time {base} | R Documentation |
Return CPU (and other) times that expr
used.
system.time(expr) unix.time(expr)
expr |
Valid R expression to be ``timed'' |
system.time
calls the builtin proc.time
,
evaluates expr
, and then calls proc.time
once more,
returning the difference between the two proc.time
calls.
The values returned by the proc.time
are (on Unix) those
returned by the C library function times
(3v).
unix.time
is an .Alias
of system.time
, for
compatibility reasons.
A numeric vector of length 5 containing the user cpu, system cpu, elapsed,
subproc1, subproc2 times. The subproc times are the the user and
system cpu time used by child processes (and so are usually zero).
On Windows the subproc times are not available and so are always
NA
. The first two components are not available on Windows 9x,
and so are reported as NA
; they do return real values on
Windows NT4 and 2000.
The resolution of the times will be system-specific; it is common for them to be recorded to of the order of 1/100 second, and elapsed time is rounded to the nearest 1/100.
proc.time
, time
which is for time series.
system.time(for(i in 1:50) mad(runif(500))) exT <- function(n = 100) { # Purpose: Test if system.time works ok; n: loop size system.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 system.time(exT()) #~ +/- same