This package provides a simple interface to run google perftools in R.
The package requires libgoogle-perftools-dev
and google-perftools
packages to be installed:
On Debian/Ubuntu run:
sudo apt install google-perftools libgoogle-perftools-dev
Install the package:
devtools::install_github("assaron/rgperftools")
Loading package:
library(rgperftools)
We'll be profiling fgsea
:
library(fgsea)
data(exampleRanks)
data(examplePathways)
Running fgsea
wrapped in profiler:
profOut <- tempfile("prof")
start_profiler(profOut)
fr <- fgseaMultilevel(examplePathways, exampleRanks, eps=0)
stop_profiler()
To get the visualization of results we first need path to used fgsea.so
:
fgseaSoPath <- getLoadedDLLs()[["fgsea"]][["path"]]
fgseaSoPath
## [1] "/home/alserg/R/x86_64-pc-linux-gnu-library/3.6/fgsea/libs/fgsea.so"
And now we can explore the profiler output with google-pprof
:
profOutSvg <- paste0(profOut, ".gif")
system2("google-pprof", args=c("--gif", fgseaSoPath, profOut),
stdout=profOutSvg)
Here is the result: