[R-SIG-Mac] profiling C shared libraries loaded into R

Michael Braun braunm at MIT.EDU
Fri Jun 12 22:20:12 CEST 2009


Hi.  I have a shared library that I would like to profile.  I see that  
this issue has been touched on in some previous posts, but I am still  
having trouble, and I am hoping someone here can help.

First things first...  I am running R 2.8.0 patched on OS X 10.5.7, on  
a dual quad-core Mac Pro.   It is the 64-bit binary build for Leopard,  
as downloaded from CRAN.

I am compiling my code using gcc-4.2, and I am including the -g -p -pg  
flags.  Optimization is turned off (-O0).  I AM able to debug the code  
using gdb (called as R -d gdb).  I always run R from the command line.

I have tried profiling using Shark, which recognizes functions in  
libR.dylib, but none of the functions in mylib.so.  For each function  
call, Shark refers to "Unknown Library", and after the function  
address, there is an indicator of [unknown].  Also, when I use Shark,  
it appears to want to profile the entire R session.  All I care about  
is my library.

I am also open to using gprof instead, but I cannot find the requisite  
gmon.out file.

Thanks in advance for any suggestions.

Michael



-------------------------------------------
Michael Braun
Homer A. Burnell Career Development Professor, and
	Assistant Professor of Management Science (Marketing Group)
MIT Sloan School of Management
One Amherst St., E40-169
Cambridge, MA 02142
braunm at mit.edu
617-253-3436



More information about the R-SIG-Mac mailing list