Author: toad
Date: 2008-02-16 22:44:03 +0000 (Sat, 16 Feb 2008)
New Revision: 18014
Modified:
trunk/freenet/src/freenet/node/NodeStats.java
trunk/freenet/src/freenet/support/Executor.java
trunk/freenet/src/freenet/support/PooledExecutor.java
Log:
Show the number of threads running at each priority level. Not the number of
threads waiting for work.
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2008-02-16 19:05:47 UTC
(rev 18013)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2008-02-16 22:44:03 UTC
(rev 18014)
@@ -780,7 +780,7 @@
public int getActiveThreadCount() {
int waitingThreads = 0;
- activeThreadsByPriorities = node.executor.waitingThreads();
+ activeThreadsByPriorities = node.executor.runningThreads();
for(int i=0; i<activeThreadsByPriorities.length; i++)
waitingThreads += activeThreadsByPriorities[i];
Modified: trunk/freenet/src/freenet/support/Executor.java
===================================================================
--- trunk/freenet/src/freenet/support/Executor.java 2008-02-16 19:05:47 UTC
(rev 18013)
+++ trunk/freenet/src/freenet/support/Executor.java 2008-02-16 22:44:03 UTC
(rev 18014)
@@ -12,6 +12,8 @@
public void execute(Runnable job, String jobName);
public void execute(Runnable job, String jobName, boolean fromTicker);
- /** Count the number of threads waiting for work */
+ /** Count the number of threads waiting for work at each priority level
*/
public int[] waitingThreads();
+ /** Count the number of threads running at each priority level */
+ public int[] runningThreads();
}
Modified: trunk/freenet/src/freenet/support/PooledExecutor.java
===================================================================
--- trunk/freenet/src/freenet/support/PooledExecutor.java 2008-02-16
19:05:47 UTC (rev 18013)
+++ trunk/freenet/src/freenet/support/PooledExecutor.java 2008-02-16
22:44:03 UTC (rev 18014)
@@ -104,6 +104,13 @@
}
}
+ public synchronized int[] runningThreads() {
+ int[] result = new int[runningThreads.length];
+ for(int i=0; i<result.length; i++)
+ result[i] = runningThreads[i].size();
+ return result;
+ }
+
public synchronized int[] waitingThreads() {
int[] result = new int[waitingThreads.length];
for(int i=0; i<result.length; i++)