R/rprof-read.R
, R/pprof-read.R
, R/rprof-write.R
, and 1 more
read_rprof.Rd
These functions read profile data from files, or store profile data to files.
Readers call validate_profile()
on input, writers on output.
read_rprof()
reads a file generated by Rprof()
, write_rprof()
writes
in a compatible format.
read_pprof()
reads a file generated by pprof -proto
, write_pprof()
writes a Gzip-compressed file that can be processed with pprof
.
read_rprof(path, ..., version = "1.0")
read_pprof(path, ..., version = "1.0")
write_rprof(x, path)
write_pprof(x, path)
File name
Ignored
Version of the data, currently only "1.0"
is supported.
Pass an explicit value to this argument if your code depends on the data
format.
Profiler data, see validate_profile()
Valid profile data (readers), input data (writers).
Use the proftools, profvis, or prof.tree R packages to
further analyze files created by the write_rprof()
function.
Use the pprof
tool in conjunction with
the _pprof()
functions. The tool is available in the pprof R package,
or (in newer versions) via go get github.com/google/pprof
.
rprof_file <- system.file("samples/rprof/1.out", package = "profile")
ds <- read_rprof(rprof_file)
ds
#> Profile data: 22 samples
if (requireNamespace("RProtoBuf", quietly = TRUE)) {
pprof_file <- tempfile("profile", fileext = ".pb.gz")
write_pprof(ds, pprof_file)
}