I'd like to be able to run callr::r_bg() and then get the duration of time it took to run func, or at least time from opening the R session to it being killed if its too difficult to get timing for the func itself.
One can get the start time with x$get_start_time(), but there is no way that I can see to get the end time. Right now as a hack I do:
library(callr)
x <- r_bg(function() { Sys.sleep(5); "1 done" })
x$wait()
end_time <- as.POSIXlt(Sys.time(), tz = "GMT")
start_time <- x$get_start_time()
as.numeric(end_time - start_time) # duration
let me know if I should instead open this in processx repo
I'd like to be able to run
callr::r_bg()and then get the duration of time it took to run func, or at least time from opening the R session to it being killed if its too difficult to get timing for the func itself.One can get the start time with
x$get_start_time(), but there is no way that I can see to get the end time. Right now as a hack I do:let me know if I should instead open this in
processxrepo