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/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?
Thank you in advance,
Pavel Krivitsky
Profiling C functions called from R.
2 messages · Pavel N. Krivitsky, Brian Ripley
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/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@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