proc.time {base} | R Documentation

## Running Time of R

### Description

`proc.time` determines how much time (in seconds) the currently running R process already consumed.

### Usage

    proc.time()

### Value

A numeric vector of length 5, containing the user, system, and total elapsed times for the currently running R process, and the cumulative sum of user and system times of any child processes spawned by it.
The resolution of the times will be system-specific; and times are rounded to the nearest 1ms. On modern systems they will be that accurate, but on older systems they might be accurate to 1/100 or 1/60 sec.
It is most useful for “timing” the evaluation of R expressions, which can be done conveniently with `system.time`.

### Note

It is possible to compile R without support for `proc.time`, when the function will throw an error.

### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

### See Also

`system.time` for timing a valid R expression, `gc.time` for how much of the time was spent in garbage collection.

### Examples

    ## Not run:
    ## a way to time an R expression: system.time is preferred
    ptm <- proc.time()
    for (i in 1:50) mad(runif(500))
    proc.time() - ptm
    ## End(Not run)

[Package base version 2.3.1 Index]