Author: toad
Date: 2008-02-19 16:02:22 +0000 (Tue, 19 Feb 2008)
New Revision: 18064

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/NodeStats.java
Log:
Fix thread count. Show number waiting as well as number running. 
StatisticsToadlet.amount -> .running

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2008-02-19 15:48:15 UTC (rev 18063)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2008-02-19 16:02:22 UTC (rev 18064)
@@ -392,17 +392,20 @@
                node.addChild("div", "class", "infobox-header", 
l10n("threadsByPriority"));
                HTMLNode threadsInfoboxContent = node.addChild("div", "class", 
"infobox-content");
                int[] activeThreadsByPriority = 
stats.getActiveThreadsByPriority();
+               int[] waitingThreadsByPriority = 
stats.getWaitingThreadsByPriority();

                HTMLNode threadsByPriorityTable = 
threadsInfoboxContent.addChild("table", "border", "0");
                HTMLNode row = threadsByPriorityTable.addChild("tr");

                row.addChild("th", l10n("priority"));
-               row.addChild("th", l10n("amount"));             
+               row.addChild("th", l10n("running"));
+               row.addChild("th", l10n("waiting"));

                for(int i=0; i<activeThreadsByPriority.length; i++) {
                        row = threadsByPriorityTable.addChild("tr");
                        row.addChild("td", String.valueOf(i+1));
-                       row.addChild("td", 
String.valueOf(activeThreadsByPriority[i]));         
+                       row.addChild("td", 
String.valueOf(activeThreadsByPriority[i]));
+                       row.addChild("td", 
String.valueOf(waitingThreadsByPriority[i]));
                }
        }


Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-02-19 
15:48:15 UTC (rev 18063)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-02-19 
16:02:22 UTC (rev 18064)
@@ -985,7 +985,8 @@
 StatisticsToadlet.threads=Running threads: ${running}/${max}
 StatisticsToadlet.threadsByPriority=Threads by priority
 StatisticsToadlet.priority=Priority
-StatisticsToadlet.amount=Amount
+StatisticsToadlet.running=Running
+StatisticsToadlet.waiting=Waiting
 StatisticsToadlet.totalInput=Total Input: ${total} (${rate}/sec)
 StatisticsToadlet.totalOutput=Total Output: ${total} (${rate}/sec)
 StatisticsToadlet.transferringRequests=Transferring Requests: sending 
${senders}, receiving ${receivers}

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-02-19 15:48:15 UTC 
(rev 18063)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-02-19 16:02:22 UTC 
(rev 18064)
@@ -165,6 +165,7 @@
        // ThreadCounting stuffs
        public final ThreadGroup rootThreadGroup;
        private int[] activeThreadsByPriorities = new 
int[NativeThread.JAVA_PRIO_RANGE];
+       private int[] waitingThreadsByPriorities = new 
int[NativeThread.JAVA_PRIO_RANGE];
        private int threadLimit;

        // Free heap memory threshold stuffs
@@ -780,6 +781,7 @@

        public int getActiveThreadCount() {
                int waitingThreads = 0;
+               waitingThreadsByPriorities = node.executor.waitingThreads();
                activeThreadsByPriorities = node.executor.runningThreads();
                for(int i=0; i<activeThreadsByPriorities.length; i++)
                        waitingThreads += activeThreadsByPriorities[i];
@@ -790,6 +792,10 @@
        public int[] getActiveThreadsByPriority() {
                return activeThreadsByPriorities;
        }
+       
+       public int[] getWaitingThreadsByPriority() {
+               return waitingThreadsByPriorities;
+       }

        public int getThreadLimit() {
                return threadLimit;


Reply via email to