[Rd] Profiling C functions called from R.
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Feb 26 09:17:12 CET 2005
On Fri, 25 Feb 2005, Pavel N. Krivitsky wrote:
> 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
> LD_PROFILE=/path/to/C/library.so 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/foo.so.profile.
Linux's documentation is far, far sketchier.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel