record_rprof: Profile R code and record Rprof samples.

View source: R/record.R

record_rprofR Documentation

Profile R code and record Rprof samples.

Description

Run R code and record Rprof samples.

Usage

record_rprof(expr, seconds_timeout = Inf, rprof = tempfile(), ...)

Arguments

expr

An R expression to profile.

seconds_timeout

Maximum number of seconds of elapsed time to profile expr. When the timeout is reached, proffer stops running expr and returns the profiling samples taken during the seconds_timeout time window.

rprof

Path to a file with Rprof samples. Also returned from the function.

...

Additional arguments passed on to Rprof().

Value

Path to a file with Rprof samples.

Examples

if (identical(Sys.getenv("PROFFER_EXAMPLES"), "true")) {
# Returns a path to Rprof samples.
record_rprof(replicate(1e2, sample.int(1e4)))
}

proffer documentation built on April 4, 2025, 1:58 a.m.