profile (version 1.0.3)

read_rprof: 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)

Value

Valid profile data (readers), input data (writers).

Arguments

path

File name

...

Ignored

version

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.

x

Profiler data, see validate_profile()

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.

Examples

Run this code
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)
}

Run the code above in your browser using DataCamp Workspace