Author: bback
Date: 2006-10-06 06:40:06 +0000 (Fri, 06 Oct 2006)
New Revision: 10628

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
Added average access rate to store stats, added a debug stat to catch the big 
max storesizes

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-05 23:33:24 UTC (rev 10627)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-06 06:40:06 UTC (rev 10628)
@@ -350,7 +350,7 @@
                 HTMLNode storeSizeInfoboxContent = 
storeSizeInfobox.addChild("div", "class", "infobox-content");
                 HTMLNode storeSizeList = 
storeSizeInfoboxContent.addChild("ul");

-                long fix32kb = 32 * 1024;
+                final long fix32kb = 32 * 1024;

                 long cachedKeys = node.getChkDatacache().keyCount();
                 long cachedSize = cachedKeys * fix32kb;
@@ -366,8 +366,11 @@

                 long cachedStoreHits = node.getChkDatacache().hits();
                 long cachedStoreMisses = node.getChkDatacache().misses();
+                long cacheAccesses = cachedStoreHits + cachedStoreMisses;
                 long storeHits = node.getChkDatastore().hits();
                 long storeMisses = node.getChkDatastore().misses();
+                long storeAccesses = storeHits + storeMisses;
+                long overallAccesses = storeAccesses + cacheAccesses;

                 storeSizeList.addChild("li", 
                         "Cached keys:\u00a0" + 
thousendPoint.format(cachedKeys) + 
@@ -375,8 +378,8 @@

                 storeSizeList.addChild("li", 
                         "Cache hits:\u00a0" + 
thousendPoint.format(cachedStoreHits) + 
-                        
"\u00a0/\u00a0"+thousendPoint.format(cachedStoreHits+cachedStoreMisses) +
-                        "\u00a0(" + ((cachedStoreHits*100) / 
(cachedStoreHits+cachedStoreMisses)) + "%)");
+                        "\u00a0/\u00a0"+thousendPoint.format(cacheAccesses) +
+                        "\u00a0(" + ((cachedStoreHits*100) / (cacheAccesses)) 
+ "%)");

                 storeSizeList.addChild("li", 
                         "Stored keys:\u00a0" + thousendPoint.format(storeKeys) 
+ 
@@ -384,12 +387,19 @@

                 storeSizeList.addChild("li", 
                         "Store hits:\u00a0" + thousendPoint.format(storeHits) 
+ 
-                        
"\u00a0/\u00a0"+thousendPoint.format(storeHits+storeMisses) +
-                        "\u00a0(" + ((storeHits*100) / 
(storeHits+storeMisses)) + "%)");
+                        "\u00a0/\u00a0"+thousendPoint.format(storeAccesses) +
+                        "\u00a0(" + ((storeHits*100) / (storeAccesses)) + 
"%)");

                 storeSizeList.addChild("li", 
-                        "Overall:\u00a0" + thousendPoint.format(overallKeys) + 
"/" + thousendPoint.format(maxOverallKeys) +
+                        "Avg. access rate:\u00a0" + 
thousendPoint.format(overallAccesses/nodeUptimeSeconds) + "/s");
+
+                storeSizeList.addChild("li", 
+                        "Overall size:\u00a0" + 
thousendPoint.format(overallKeys) + "/" + thousendPoint.format(maxOverallKeys) +
                         "\u00a0(~" + SizeUtil.formatSize(overallSize) + "/" + 
SizeUtil.formatSize(maxOverallSize) + ")");
+
+                // FIXME: DEBUG
+                storeSizeList.addChild("li", 
+                        "Debug(max_C/S):\u00a0" + 
thousendPoint.format(maxCachedKeys) + "/" + thousendPoint.format(maxStoreKeys));
             }

             nextTableCell = advancedEnabled ? overviewTableRow.addChild("td") 
: overviewTableRow.addChild("td", "class", "last");
@@ -410,10 +420,12 @@
                 long allocatedJavaMem = (long)totalMemory;
                 long maxJavaMem = (long)maxMemory;
                 int threadCount = Thread.activeCount();
+                int availableCpus = rt.availableProcessors();

                 jvmStatsList.addChild("li", "Used Java memory:\u00a0" + 
SizeUtil.formatSize(usedJavaMem));
                 jvmStatsList.addChild("li", "Allocated Java memory:\u00a0" + 
SizeUtil.formatSize(allocatedJavaMem));
                 jvmStatsList.addChild("li", "Maximum Java memory:\u00a0" + 
SizeUtil.formatSize(maxJavaMem));
+                jvmStatsList.addChild("li", "Available CPUs:\u00a0" + 
availableCpus);
                 jvmStatsList.addChild("li", "Running threads:\u00a0" + 
thousendPoint.format(threadCount));
             }
                }


Reply via email to