R/timer.R

Timer <- R6::R6Class("Timer", cloneable = TRUE, lock_class = TRUE, lock_objects = TRUE, public = list(
  start = NULL,
  initialize = function() {
    self$start <- proc.time()
  },
  elapsed = function() {
    x <- proc.time() - self$start
    if (!is.na(x[[4L]])) 
        x[[1L]] <- x[[1L]] + x[[4L]]
    if (!is.na(x[[5L]])) 
        x[[2L]] <- x[[2L]] + x[[5L]]
    c(user=x[[1L]], system=x[[2L]], wallclock=x[[3L]])
  },
  wallclock = function() {
    proc.time()[[3L]] - self$start[[3L]]
  })
)

Try the irace package in your browser

Any scripts or data that you put into this service are public.

irace documentation built on April 3, 2025, 10:03 p.m.