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.


profile

rcc Codecov test coverage 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.

Installation

You can install profile from GitHub with:

# install.packages("remotes")
remotes::install_github("r-prof/profile")

Example

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))
Rprof(NULL)

library(profile)
ds <- read_rprof(rprof_path)
ds
#> Profile data: 28 samples
names(ds)
#> [1] "meta"         "sample_types" "samples"      "locations"    "functions"   
#> [6] ".rprof"
write_pprof(ds, file.path(tempdir(), "1.pb.gz"))

Code of Conduct

Please note that the profile project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Reference manual

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

install.packages("profile")

1.0.4 by Kirill Müller, a year ago


https://r-prof.github.io/profile/, https://github.com/r-prof/profile


Report a bug at https://github.com/r-prof/profile/issues


Browse source code at https://github.com/cran/profile


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


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports methods, rlang, tibble, vctrs, withr

Suggests covr, dm, DiagrammeR, DiagrammeRsvg, RProtoBuf, testthat


Imported by proffer.


See at CRAN