Then IndexClient.main() should just call init too... -Stefan
----- Original Message ----- From: "Oskar Sandberg" <[email protected]> To: <devl at freenetproject.org> Sent: Saturday, June 02, 2001 7:35 PM Subject: Re: [freenet-devl] IndexClient CPU eater finally discovered > > We have been through this before with other clients, that you have to call > init is well documented... > > The whole "tickerTime" thing is completely unnecessary anyways, it might > as well just sleep for the time remaining until the top object on the > stack (just make sure any code that changes the stack interrupts it). I > have already fixed that in the experimental branch, somebody could just > backport it. > > > On Sat, Jun 02, 2001 at 06:57:46PM +0200, Stefan Reich wrote: > > Using OptimizeIT (a superb product, too bad it costs at least $300), I finally found out why IndexClient is eating CPU cycles. > > > > It's the Ticker class. A Ticker is created with a tickerTime of 0 ms - thus the ticker never sleeps and constantly polls its event queue. > > > > The Ticker is created by Core() that passes the value of the static variable Core.tickerTime to the Ticker constructor - and Core.tickerTime is 0. > > > > What happens is this: > > > > -in the beginning, Core.tickerTime is 0 (VM default value) > > -IndexClient(Params, Logger) creates a SimplifiedClient > > --SimplifiedClient(Params, Logger) (indirectly) calls CLI(Params, Logger, boolean) > > ---CLI(Params, Logger, boolean) calls ClientUtil.getServiceCore(int) > > ----ClientUtil.getServiceCore(int) creates a ClientCore > > -----ClientCore(ListeningAddress, Presentation) calls the Core constructor > > ------Core(ListeningAddress, Presentation, HandshakeHandler) creates a Timer with a tickerTime value of 0 => BANG! > > --now SimplifiedClient(Params, Logger) calls Core.init(Params) which sets Core.tickerTime to a reasonable value -- but it's already TOO LATE! > > > > A workaround is to call Core.init(someParams) before creating the first IndexClient. I leave devising a real bug fix to Brandon... ;-) > > > > Also, I have no idea why this doesn't happen on non-Windows platforms. Maybe a sleep(0) does sleep for a few ms on Unix...? > > > > BTW: I leeched Freenet from CVS 4 weeks ago or so - I hope this trackdown isn't obsolete by now... > > > > -Stefan > > > > -- > 'DeCSS would be fine. Where is it?' > 'Here,' Montag touched his head. > 'Ah,' Granger smiled and nodded. > > Oskar Sandberg > oskar at freenetproject.org > > _______________________________________________ > Devl mailing list > Devl at freenetproject.org > http://lists.freenetproject.org/mailman/listinfo/devl _______________________________________________ Devl mailing list Devl at freenetproject.org http://lists.freenetproject.org/mailman/listinfo/devl
