Read, Manipulate, and Write Profiler Data

Defines a data structure for profiler data, and methods to read and write from the 'Rprof' and 'pprof' file formats.

Travis build status Coverage status CRAN status

The goal of profile is to read and write files that contain run time profiling data. Currently, profile supports:

  • Files created by Rprof()
  • .proto files written by pprof -proto, these can also be read by pprof

The data is available to the user for inspection and manipulation in a documented stable data format.


You can install profile from GitHub with:



This simple example converts an .out file generated by Rprof() to the .proto format understood by pprof.

rprof_path <- tempfile("profile", fileext = ".out")
Rprof(rprof_path, line.profiling = TRUE)
x <- runif(1e6)
res <- vapply(x, function(x) if (x < 0.5) sqrt(x) else x * x, numeric(1))
ds <- read_rprof(rprof_path)
#> Profile data: 33 samples
#> [1] "meta"         "sample_types" "samples"      "locations"   
#> [5] "functions"    ".rprof"
write_pprof(ds, file.path(tempdir(), "1.pb.gz"))


profile 1.0 (2018-01-03)

Initial release. Exported functions:

  • read_rprof(path, ..., version = "1.0") and write_rprof(x, path) for reading files generated by Rprof() and writing compatible files.

  • read_pprof(path, ..., version = "1.0") and write_pprof(x, path) for reading and writing files understood by pprof.

  • validate_profile(x) for validating profile data, called by the readers and writers.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0 by Kirill Müller, 5 months ago,

Report a bug at

Browse source code at

Authors: Kirill Müller [aut, cre], R Consortium [fnd]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports methods, rlang, tibble, withr

Suggests RProtoBuf, testthat

See at CRAN