[R] Problem about Rprof() (Windows build 1.6.2)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Sun Jan 26 17:32:02 CET 2003


I have no idea what had changed.  The issue appears to be that the timing
thread used under Windows was not being started by _beginthread until the
current timeslice for the main thread finished *on a single-CPU* machine.

That's not what is documented to happen (nor used to happen), but adding
Sleep(wait/2) in the initialization allows the timing thread to start.

I had run some tests on a dual-CPU machine, and they worked as expected.

There is a workaround in R-devel.  Otherwise, add a call to
Sys.sleep(1) after Rprof() in your script, and that should suffice
to get profiling started.  (You may need to experiment with the number, 
which probably needs to be over 0.5secs to ensure that the sleep really 
does happen.)

On 13 Jan 2003, Peter Dalgaard BSA wrote:

> <asone at latte.harvard.edu> writes:
> 
> > Thank you for your advice, Prof. Ripley.
> > 
> > What I found after your e-mail is as follows:
> > 
> > when the following 4 command lines are typed in R Console one by one on
> > R (windows) Version 1.6.2  (2003-01-10), 
> > 
> > Rprof()
> > example(lm)
> > Rprof(NULL)
> > summaryRprof()
> > 
> > I got profiling results.
> > 
> > However, when I typed the following line in the R console,
> > 
> > 	Rprof(); example(lm); Rprof(NULL); summaryRprof()
> > 
> > or 
> > 
> > the above 4 command lines were saved as a program file, "testRprof.R",
> > and it was executed as:
> > 
> > 	>source("C:/asone/R/testRprof.R")
> > 
> > then I got the following error:
> > 
> > 	Error in summaryRprof() : no events were recorded
> 
> Interesting. For whatever it is worth, it doesn't seem to happen on
> Linux, so it is not the command interpreter per se. What happens if
> you turn off the "buffer output" option?
> 
> 

-- 
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