This is intended for application to the tables which get attached to Cpe instances after invocation of the $trace_paths() method. But any table with columns named pid, t1 and t2 suffices.

plot_dutycycle(perftab, ..., FUN = c(workers = sum), layout = c(1, NA))

Arguments

perftab

A performance table with columns:

  • pid An integer, character or factor with process ids

  • t1, t2 Task start and end times, in milliseconds

...

Optional parameters passed along to lattice::xyplot

FUN

A function for summarizing all workers' duty cycles

layout

Trellis layout, passed to xyplot

Value

An xyplot with a duty-cycle panel for each worker, plus an overall average

Examples

if (interactive()) {
  ## Example from Braun2020
  d1_maxn <- 5
  cum_maxn <- 10
  mod <- Crm$new(skeleton = c(0.03, 0.11, 0.25, 0.42, 0.58, 0.71),
                 scale = 0.85, # aka 'sigma'
                 target = 0.25)$
    no_skip_esc(TRUE)$    # compare Braun's 'restrict = T'
    no_skip_deesc(FALSE)$
      stop_func(function(x) {
        enrolled <- tabulate(x$level, nbins = length(x$prior))
        x$stop <- enrolled[1] >= d1_maxn || max(enrolled) >= cum_maxn
        x
      })
  mod$trace_paths(1, rep(2, 13), unroll = 4
                , mc.cores = parallelly::availableCores(omit=2))
  print(mod$performance)
  plot_dutycycle(mod$performance)
}