Skip to content

Profiling C functions called from R.

2 messages · Pavel N. Krivitsky, Brian Ripley

#
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
#
On Fri, 25 Feb 2005, Pavel N. Krivitsky wrote:

            
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.