Returns and (optionally) prints the total and/or partial (since the last call to this function) real and CPU times.
cpu.time(..., reset = FALSE, total = TRUE, last = TRUE, flush = FALSE)
objects (describing the last operation) to be printed (using cat
),
if last == TRUE
.
logical; if TRUE
, time counters are initialized.
logical; if TRUE
, the total time used is printed.
logical; if TRUE
, the partial time used is printed.
logical; if TRUE
, flush.console
is called.
Invisibly returns a list with the following 3 components
(objects of class "proc_time"
):
cpu.time(reset=TRUE)
#> CPU time has been initialized.
res <- median(runif(100000))
cpu.time('\nSample median of', 100000, 'values =', res)
#> Time of last operation:
#> Sample median of 1e+05 values = 0.4941131
#> user system elapsed
#> 0 0 0
#> Total time:
#> user system elapsed
#> 0 0 0
res <- median(runif(1000))
cpu.time('\nSample median of', 1000, 'values =', res)
#> Time of last operation:
#> Sample median of 1000 values = 0.5098087
#> user system elapsed
#> 0 0 0
#> Total time:
#> user system elapsed
#> 0 0 0