README.md

gprofiler - Profile the C++ behind your R code

A wrapper around Google's perftools profiler and pprof visualizer.

Usage

library(gprofiler)
profile(my_expensive_function(100000))   # On completion, shows results in a web browser.

Results are only meaningful if my_expensive_function(100000) takes longer than around 30 seconds.

The gprofiler::profile() function profiles only C++ code. To profile R code, use the profviz package instead.

Installation

1. Install google-perftools and pprof

Ubuntu Linux

sudo apt-get install libgoogle-perftools-dev

sudo apt-get install golang-go    # In case you don't have go installed.
export GOPATH=$HOME/go            # Add this to your .bash_profile.
export PATH=$PATH:$GOPATH/bin     # Add this to your .bash_profile.
go get github.com/google/pprof

OS X

brew install google-perftools

brew install binutils                                        # For gobjdump.
sudo ln -s /usr/local/bin/gobjdump /usr/local/bin/objdump    # Needed by pprof.

brew install go --cross-compile-common    # In case you don't have go installed.
export GOPATH=$HOME/go                    # Add this to your .bash_profile.
export PATH=$PATH:$GOPATH/bin             # Add this to your .bash_profile.
go get github.com/google/pprof
sudo mv /usr/local/bin/pprof /usr/local/bin/pprof.pl  # Ignore the older pprof.

2. Install the gprofiler R Package

library(devtools)
devtools::install_github('nimble-dev/gprofiler')


nimble-dev/gprofiler documentation built on Dec. 15, 2018, 4:07 p.m.