On Tuesday 27 January 2009 15:13:38 [email protected] wrote: > Author: nextgens > Date: 2009-01-27 15:13:37 +0000 (Tue, 27 Jan 2009) > New Revision: 25317 > > Modified: > trunk/freenet/src/freenet/node/NodeStats.java > Log: > cache the results for 60 secs
IMHO this is over-optimisation. The only case in which we use this is
rendering the statistics page in advanced mode. If the user wants detailed
diagnostics, we should give them up to date and accurate figures.
>
> Modified: trunk/freenet/src/freenet/node/NodeStats.java
> ===================================================================
> --- trunk/freenet/src/freenet/node/NodeStats.java 2009-01-27 15:07:03 UTC
(rev 25316)
> +++ trunk/freenet/src/freenet/node/NodeStats.java 2009-01-27 15:13:37 UTC
(rev 25317)
> @@ -172,6 +172,8 @@
>
> // ThreadCounting stuffs
> public final ThreadGroup rootThreadGroup;
> + private int[] activeThreadsByPriorities = new
int[NativeThread.JAVA_PRIORITY_RANGE];
> + private int[] waitingThreadsByPriorities = new
int[NativeThread.JAVA_PRIORITY_RANGE];
> private int threadLimit;
>
> final NodePinger nodePinger;
> @@ -202,6 +204,8 @@
> ThreadGroup tg = Thread.currentThread().getThreadGroup();
> while(tg.getParent() != null) tg = tg.getParent();
> this.rootThreadGroup = tg;
> + this.activeThreadsByPriorities = new
int[NativeThread.JAVA_PRIORITY_RANGE];
> + this.waitingThreadsByPriorities = new
int[NativeThread.JAVA_PRIORITY_RANGE];
> throttledPacketSendAverage =
> new TimeDecayingRunningAverage(1, 10*60*1000 /* should
> be significantly
longer than a typical transfer */, 0, Long.MAX_VALUE, node);
> nodePinger = new NodePinger(node);
> @@ -423,6 +427,10 @@
> long end = System.currentTimeMillis();
> if(logMINOR)
> Logger.minor(this, "Throttle
> check
took "+TimeUtil.formatTime(end-now,2,true));
> +
> + // Doesn't belong here... but anyway,
> should do the job.
> + activeThreadsByPriorities =
> node.executor.runningThreads();
> + waitingThreadsByPriorities =
> node.executor.waitingThreads();
> }
> }
> };
> @@ -1016,11 +1024,11 @@
> }
>
> public int[] getActiveThreadsByPriority() {
> - return node.executor.runningThreads();
> + return activeThreadsByPriorities;
> }
>
> public int[] getWaitingThreadsByPriority() {
> - return node.executor.waitingThreads();
> + return waitingThreadsByPriorities;
> }
>
> public int getThreadLimit() {
>
> _______________________________________________
> cvs mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
