This help topic is for R version 0.90. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/system.time.html
system.time {base}R Documentation

CPU Time Used

Description

Return CPU (and other) times that expr used.

Usage

system.time(expr)
unix.time(expr)

Arguments

expr

Valid R expression to be “timed”

Details

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 (currently) those returned by the C library function times(3v).

unix.time is an .Alias of system.time, for compatibility reasons.

Value

A numeric vector of length 5 containing the cpu, user, total, subproc1, subproc2 times.

See Also

proc.time, time which is for time series.

Examples

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

[Package base version 0.90 ]