From p.dalgaard at biostat.ku.dk  Tue Sep 16 15:21:26 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Tue Sep 16 16:21:28 2003
Subject: [Rd] RAqua too hungry of cpu time
In-Reply-To: <60A5EC5A-E838-11D7-86DE-003065CC4CB8@mclink.it>
References: <60A5EC5A-E838-11D7-86DE-003065CC4CB8@mclink.it>
Message-ID: <x2u17c3j6p.fsf@biostat.ku.dk>

Stefano Iacus <jago@mclink.it> writes:

> On Marted?, set 16, 2003, at 11:35 Europe/Rome, Simon Urbanek wrote:
> 
> > On Tuesday, September 16, 2003, at 10:24 AM, Stefano Iacus wrote:
> >
> >> It seems that RAqua consumes too much cpu time when doing nothing.
> >> I can't see exactly why this is happening. We have few days to fix
> >> this up. Any idea (after having look at the code) would be fine.
> >
> > Well, it happens exactly what the code says ;). RAqua is spending
> > all the time in those loops like this one:
> >
> >    while(!InputFinished & !HaveBigBuffer)
> >         Raqua_ProcessEvents();
> >
> > (This one comes from Raqua_ReadConsole)
> >
> > Since in Raqua_ProcessEvents you simply call ReceiveNextEvent with
> > kEventDurationNoWait, the function returns almost immediately and is
> > called again ... so in effect you are hogging 100% CPU. I'd suggest
> > using either some sensible timeout or kEventDurationForever.
> 
> yes, kEventDurationForever is only a partial solution as all the
> timers I have setup to refresh the console etc won't work.
> Is there any way to let the timer wake-up ReceiveNextEvent when
> kEventDurationForever is set? This will be the solution.

Can't you just set the timeout to 10ms or so? That's basically what
the select() based mechanism for X11 does.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] RAqua too hungry of cpu time
Peter Dalgaard BSA