Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get run time duration for callr::r_bg #218

Open
sckott opened this issue Aug 1, 2019 · 1 comment
Open

Add ability to get run time duration for callr::r_bg #218

sckott opened this issue Aug 1, 2019 · 1 comment
Labels
feature a feature request or enhancement

Comments

@sckott
Copy link

sckott commented Aug 1, 2019

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

@gaborcsardi
Copy link
Member

Yeah, I guess this is more of a processx feature, I'll move it over there.

@gaborcsardi gaborcsardi transferred this issue from r-lib/callr Aug 2, 2019
@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants