Author: ljn1981
Date: 2006-09-27 20:23:17 +0000 (Wed, 27 Sep 2006)
New Revision: 10521

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/node/Node.java
Log:
Adding location swap stats to the statistics toadlet.

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-09-27 19:10:44 UTC (rev 10520)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-09-27 20:23:17 UTC (rev 10521)
@@ -268,6 +268,34 @@
                                        }
                                }
                        }
+                       
+                       //Swap statistics box
+                       if(advancedEnabled) {
+                               overviewTableRow = overviewTable.addChild("tr");
+                               nextTableCell = overviewTableRow.addChild("td", 
"class", "first");
+                               int swaps = node.getSwaps();
+                               int noSwaps = node.getNoSwaps();
+                               int startedSwaps = node.getStartedSwaps();
+                               int swapsRejectedAlreadyLocked = 
node.getSwapsRejectedAlreadyLocked();
+                               int swapsRejectedNowhereToGo = 
node.getSwapsRejectedNowhereToGo();
+                               int swapsRejectedRateLimit = 
node.getSwapsRejectedRateLimit();
+                               int swapsRejectedLoop = 
node.getSwapsRejectedLoop();
+                               int swapsRejectedRecognizedID = 
node.getSwapsRejectedRecognizedID();
+                               
+                               HTMLNode locationSwapInfobox = 
nextTableCell.addChild("div", "class", "infobox");
+                               locationSwapInfobox.addChild("div", "class", 
"infobox-header", "Location swaps");
+                               HTMLNode locationSwapInfoboxContent = 
locationSwapInfobox.addChild("div", "class", "infobox-content");
+                               HTMLNode locationSwapList = 
locationSwapInfoboxContent.addChild("ul");
+                               locationSwapList.addChild("li", "swaps:\u00a0" 
+ swaps);
+                               locationSwapList.addChild("li", 
"noSwaps:\u00a0" + noSwaps);
+                               locationSwapList.addChild("li", 
"startedSwaps:\u00a0" + startedSwaps);
+                               locationSwapList.addChild("li", 
"swapsRejectedAlreadyLocked:\u00a0" + swapsRejectedAlreadyLocked);
+                               locationSwapList.addChild("li", 
"swapsRejectedNowhereToGo:\u00a0" + swapsRejectedNowhereToGo);
+                               locationSwapList.addChild("li", 
"swapsRejectedRateLimit:\u00a0" + swapsRejectedRateLimit);
+                               locationSwapList.addChild("li", 
"swapsRejectedLoop:\u00a0" + swapsRejectedLoop);
+                               locationSwapList.addChild("li", 
"swapsRejectedRecognizedID:\u00a0" + swapsRejectedRecognizedID);
+                               nextTableCell = overviewTableRow.addChild("td");
+                       }
                }

                StringBuffer pageBuffer = new StringBuffer();

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-09-27 19:10:44 UTC (rev 
10520)
+++ trunk/freenet/src/freenet/node/Node.java    2006-09-27 20:23:17 UTC (rev 
10521)
@@ -2654,7 +2654,39 @@
        public int getNetworkSizeEstimate(long timestamp) {
          return lm.getNetworkSizeEstimate( timestamp );
        }
+       
+       public int getSwaps() {
+               return lm.swaps;
+       }

+       public int getNoSwaps() {
+               return lm.noSwaps;
+       }
+
+       public int getStartedSwaps() {
+               return lm.startedSwaps;
+       }
+
+       public int getSwapsRejectedAlreadyLocked() {
+               return lm.swapsRejectedAlreadyLocked;
+       }
+
+       public int getSwapsRejectedLoop() {
+               return lm.swapsRejectedLoop;
+       }
+
+       public int getSwapsRejectedNowhereToGo() {
+               return lm.swapsRejectedNowhereToGo;
+       }
+
+       public int getSwapsRejectedRateLimit() {
+               return lm.swapsRejectedRateLimit;
+       }
+
+       public int getSwapsRejectedRecognizedID() {
+               return lm.swapsRejectedRecognizedID;
+       }
+
        /**
         * Add a PeerNode routing backoff reason to the map
         */


Reply via email to