[Rd] Possible bug, Rprof() and scan(pipe()) (PR#1140)

Luke Tierney luke@nokomis.stat.umn.edu
Sun, 4 Nov 2001 07:18:24 -0600


This feels like a system call restarting issue.  Some OS's restart
system calls after signals, others do not. For those that don't, low
level reads need to check for EINTR and such.  Connections use high
level reads, which should be insulated by the stdio library.  Possibly
dawrin's gets this wrong.  If strace is available you might be able to
tell that way.

luke

On Sun, Nov 04, 2001 at 02:01:10PM +0100, ripley@stats.ox.ac.uk wrote:
> This does not happen on Solaris or Linux, so must be related to the use of
> signals on darwin.
> 
> It probably means Rprof should be avoided on that platform, but the
> porter (Jan de Leeuw) needs to investigate.
> 
> 
> On Tue, 23 Oct 2001 macq@llnl.gov wrote:
> 
> > This looks like a bug?
> > Unable to use scan(pipe()) while profiling.
> > I have no idea whether this version of R violates the
> >     "do not use `Rprof' in an executable built for profiling"
> > warning in ?Rprof.
> >
> > Thanks
> > -Don
> >
> > >  version
> >           _
> > platform powerpc-apple-darwin1.4
> > arch     powerpc
> > os       darwin1.4
> > system   powerpc, darwin1.4
> > status   Patched
> > major    1
> > minor    3.1
> > year     2001
> > month    10
> > day      15
> > language R
> > >
> > >  foo <- scan(pipe('ls -1 | head -3'),what='')
> > Read 3 items
> > >  foo
> > [1] "README"      "RMfiles.dat" "RMfiles.tmp"
> > >  Rprof()
> > >  foo <- scan(pipe('ls -1 | head -3'),what='')
> > Read 0 items
> > >  foo
> > character(0)
> > >  Rprof(NULL)
> > >  foo <- scan(pipe('ls -1 | head -3'),what='')
> > Read 3 items
> > >
> >
> > note, profiling does appear to be functional:
> > >  Rprof() ; hist(rnorm(10000)) ; Rprof(NULL)
> > >  system('R CMD Rprof Rprof.out')
> >
> > Each sample represents 0.02 seconds.
> > Total run time: 0.1 seconds.
> >
> > Total seconds: time spent in function and callees.
> > Self seconds: time spent in function alone.
> >
> >     %       total       %       self
> >   total    seconds     self    seconds    name
> > 100.00      0.10      0.00      0.00     "hist"
> >   60.00      0.06      0.00      0.00     "hist.default"
> >   40.00      0.04     40.00      0.04     "rnorm"
> >   40.00      0.04      0.00      0.00     "plot"
> >   40.00      0.04      0.00      0.00     "plot.histogram"
> >   20.00      0.02      0.00      0.00     "storage.mode<-"
> >   20.00      0.02     20.00      0.02     "X11"
> >   20.00      0.02      0.00      0.00     "paste"
> >   20.00      0.02      0.00      0.00     "rect"
> >   20.00      0.02      0.00      0.00     "plot.new"
> >   20.00      0.02     20.00      0.02     "seq.default"
> >   20.00      0.02      0.00      0.00     "seq"
> >   20.00      0.02     20.00      0.02     "par"
> >
> >     %       self        %       total
> >   self     seconds    total    seconds    name
> >   40.00      0.04     40.00      0.04     "rnorm"
> >   20.00      0.02     20.00      0.02     "X11"
> >   20.00      0.02     20.00      0.02     "seq.default"
> >   20.00      0.02     20.00      0.02     "par"
> >
> > --
> > --------------------------------------
> > Don MacQueen
> > Environmental Protection Department
> > Lawrence Livermore National Laboratory
> > Livermore, CA, USA
> > --------------------------------------
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
> 
> -- 
> 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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._