read_rprof {profile} | R Documentation |
File I/O for profiler data
Description
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
.
Usage
read_rprof(path, ..., version = "1.0")
read_pprof(path, ..., version = "1.0")
write_rprof(x, path)
write_pprof(x, path)
Arguments
path |
File name |
... |
Ignored |
version |
Version of the data, currently only |
x |
Profiler data, see |
Details
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
.
Value
Valid profile data (readers), input data (writers).
Examples
rprof_file <- system.file("samples/rprof/1.out", package = "profile")
ds <- read_rprof(rprof_file)
ds
if (requireNamespace("RProtoBuf", quietly = TRUE)) {
pprof_file <- tempfile("profile", fileext = ".pb.gz")
write_pprof(ds, pprof_file)
}