cpu.time: Total and partial CPU time used

Description Usage Arguments Value See Also Examples

Description

Returns and (optionally) prints the total and/or partial (since the last call to this function) real and CPU times.

Usage

1
2
cpu.time(..., reset = FALSE, total = TRUE, last = TRUE,
  flush = FALSE)

Arguments

...

objects (describing the last operation) to be printed (using cat), if last == TRUE.

reset

logical; if TRUE, time counters are initialized.

total

logical; if TRUE, the total time used is printed.

last

logical; if TRUE, the partial time used is printed.

flush

logical; if TRUE, flush.console is called.

Value

Invisibly returns a list with the following 3 components (objects of class "proc_time"):

time

user, system, and total elapsed times for the currently running R process (result of a call to proc.time).

last, total

differences between the corresponding proc.time calls.

See Also

proc.time, system.time, flush.console.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
 
 cpu.time(reset=TRUE)
 res <- median(runif(100000))
 cpu.time('\nSample median of', 100000, 'values =', res)
 res <- median(runif(1000))
 cpu.time('\nSample median of', 1000, 'values =', res)


## End(Not run)

npsp documentation built on July 2, 2019, 9:08 a.m.