Re: [Rd] Profiling C functions called from R.

From: Prof Brian Ripley <>
Date: Sat 26 Feb 2005 - 19:17:12 EST

On Fri, 25 Feb 2005, Pavel N. Krivitsky wrote:

> Hi,
> I am working on an R package which includes some C routines. I would like to
> profile the C routines (built with GCC under Debian Linux). I tried running R
> with
> LD_PROFILE=/path/to/C/ R
> and executing functions that would invoke the code therein. The code takes
> about twice as long to run with LD_PROFILE set than without, so I am guessing
> that profiling is taking place. However, gmon.out is not generated (or at
> least I can't find it anywhere on the filesystem).
> Has anyone been able to profile shared libraries built for R in Linux?

How exactly are you trying to do this? Is R built to support profiling (see the R-admin manual)? Are you using gprof or sprof?

I would not expect that setting to produce a gmon.out (I think you have confused gprof and sprof). At least on Solaris, with this route you need not to have used -pg and you get a file like /var/tmp/ Linux's documentation is far, far sketchier.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Sat Feb 26 19:18:53 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:59 EST