This function takes a bool of whether verbose performance monitoring is on, as well as the name of the calling function, prints a monitoring initialisation message (if desired), and returns the start time.
Later monitoring steps are performed by monitor()
Value
POSIXct the time at which the function was initialised, via Sys.time().
Examples
## Initialise monitoring
start_time <- monitor_start(TRUE, "my_cool_function")
#> ℹ Verbose monitoring enabled
#> ℹ (2026-03-06 02:19:55) my_cool_function start
## Step 1
monitor_time <- monitor(TRUE, start_time, start_time, "performing step 1")
#> ℹ (0.004 secs elapsed; 0.004 secs total) performing step 1
x <- 2 + 2
## Step 2
monitor_time <- monitor(TRUE, start_time, monitor_time, "performing step 2")
#> ℹ (0.002 secs elapsed; 0.006 secs total) performing step 2
y <- 10.5^6 %% 345789
## Step 3
monitor_time <- monitor(TRUE, start_time, monitor_time, "performing step 3")
#> ℹ (0.003 secs elapsed; 0.009 secs total) performing step 3
z <- y / x^2
## Conclude monitoring
monitor_time <- monitor(TRUE, start_time, monitor_time, "done")
#> ℹ (0.003 secs elapsed; 0.011 secs total) done
