[Rcpp-devel] Linking a package to -ltmalloc from the google perftools

Dirk Eddelbuettel edd at debian.org
Tue Feb 28 21:18:29 CET 2012


On 28 February 2012 at 13:56, Douglas Bates wrote:
| >> You do have libgoogle-perftools-dev installed, right?
| >
| > Well, actually, no I didn't have that package installed.  Thanks for
| > the pointer.
| 
| Followup question: How does one invoke the cpu-profiler?  You need to
| give a path to the binary, which is actually something like
| /usr/lib/R/bin/exec/R but that needs several environment variables to
| be set.  Do you get around this by using littler?

You need to link with -lprofiler for profiling, the tcmalloc library is
another (unrelated) perftool.

Once linked with the profiling library, you can either use env vars to
control the profiling (where to log etc) or use two functions to start/end,
not unlike what Rprof does.

I do believe I used littler, but then I generally do on the command-line
(rather than R CMD BATCH et al).  A worked example should be in the "Intro to
HPC with R" slides of which the latest version may be the one from useR 2010.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list