The goal of jointprof is to assist profiling R packages that include native code (C++, C, Fortran, …). It collects profiling output simultaneously using Rprof and gperftools and provides a unified view of profiling data.
See the guide for a more detailed overview, or take a look at the internals document if you’re curious.
Other Linux distributions may work if you install the right system dependencies (let me know which!).
Install system dependencies:
Install pprof
:
Install the package:
# install.packages("remotes")
remotes::install_github("r-prof/jointprof")
Install system dependencies:
Install gperftools
(currently from a branch, pull request pending):
Install pprof
:
Install the package:
# install.packages("remotes")
remotes::install_github("r-prof/jointprof")
library(jointprof)
target_file <- "Rprof.out"
# Collect profile data
start_profiler(target_file)
## code to be profiled
stop_profiler()
# Analyze profile data
summaryRprof(target_file)
profvis::profvis(prof_input = target_file)
proftools::readProfileData(target_file)
prof.tree::prof.tree(target_file)
# Convert to pprof format and analyze
pprof_target_file <- "Rprof.pb.gz"
profile_data <- profile::read_rprof(target_file)
profile::write_rprof(profile_data, pprof_target_file)
system2(
find_pprof(),
c(
"-http",
"localhost:8080",
shQuote(pprof_target_file)
)
)