[R] (low level) profiling of code

Liaw, Andy andy_liaw at merck.com
Tue Jun 8 02:40:05 CEST 2004


Someone get out the whip...

Apologies for wasting everyone's time.  I missed setting MAIN_LDFLAGS="-pg"
in consig.site. 

Best,
Andy

> From: Prof Brian Ripley 
> 
> You normally need to switch R profiling off, as that uses the same
> interrupts as low-level profiling.
> 
> I would expect you to get gmon.out output from the the main R 
> executable 
> on any run, so the first question must be `does your OS support -pg?'
> 
> I don't think dynamically loaded code is relevant (provided 
> it is compiled
> with -pg).  I am pretty sure I managed to profile some 
> examples from the
> cluster package on RH8.0 Linux the other day.
> 
> On Mon, 7 Jun 2004, Liaw, Andy wrote:
> 
> > Dear R-help,
> > 
> > Can some one tell me how to profile compiled code 
> dynamically loaded into R?
> > Here's what I tried on our dual Opteron running SUSE Linux 
> Enterprise Server
> > 8 (GCC 3.3):
> > 
> > Start with R-patched dated 2004-06-07: 
> > 
> > (I also had MAIN_CFLAGS="-pg" in config.site.)
> > 
> > R is now configured for x86_64-unknown-linux-gnu
> > 
> >   Source directory:          .
> >   Installation directory:    /usr/local
> > 
> >   C compiler:                gcc  -O2 -g -pg -march=k8 -msse2 -m64
> >   C++ compiler:              g++  -O2 -g -pg -march=k8 -msse2 -m64
> >   Fortran compiler:          g77  -O2 -g -pg -march=k8 -msse2 -m64
> > 
> >   Interfaces supported:      X11, tcltk
> >   External libraries:        readline
> >   Additional capabilities:   PNG, JPEG
> >   Options enabled:           R profiling
> > 
> >   Recommended packages:      no
> > 
> > I then tried running 
> > 
> >   /path/to/R-patched/bin/R CMD BATCH -q -slave myscript.R
> > 
> > where inside myscript.R is call to R functions that calls 
> .C().  However,
> > this does not produce the gmon.out file.  Can anyone tell 
> me what I'm
> > missing?  Any help much appreciated!
> 
> 
> -- 
> 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-help mailing list