Author: bback
Date: 2006-10-05 17:08:45 +0000 (Thu, 05 Oct 2006)
New Revision: 10611

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
added nice overall store size statistic

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-05 16:52:13 UTC (rev 10610)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-05 17:08:45 UTC (rev 10611)
@@ -349,12 +349,30 @@
                 storeSizeInfobox.addChild("div", "class", "infobox-header", 
"Store size");
                 HTMLNode storeSizeInfoboxContent = 
storeSizeInfobox.addChild("div", "class", "infobox-content");
                 HTMLNode storeSizeList = 
storeSizeInfoboxContent.addChild("ul");
+                
+                long fix32kb = 32 * 1024;
+                
                 long cachedKeys = node.getChkDatacache().keyCount();
-                long cachedSize = cachedKeys * 32 * 1024;
+                long cachedSize = cachedKeys * fix32kb;
                 long storeKeys = node.getChkDatastore().keyCount();
-                long storeSize = storeKeys * 32 * 1024;
-                storeSizeList.addChild("li", "Cached keys:\u00a0" + 
thousendPoint.format(cachedKeys) + 
"\u00a0(~"+SizeUtil.formatSize(cachedSize)+")");
-                storeSizeList.addChild("li", "Stored keys:\u00a0" + 
thousendPoint.format(storeKeys) + 
"\u00a0(~"+SizeUtil.formatSize(storeSize)+")");
+                long storeSize = storeKeys * fix32kb;
+                long overallKeys = cachedKeys + storeKeys;
+                long overallSize = cachedSize + storeSize;
+                
+                long maxCachedKeys = node.getChkDatacache().getMaxKeys();
+                long maxStoreKeys = node.getChkDatastore().getMaxKeys();
+                long maxOverallKeys = maxCachedKeys+maxStoreKeys;
+                long maxOverallSize = maxOverallKeys * fix32kb;
+                
+                storeSizeList.addChild("li", 
+                        "Cached keys:\u00a0" + 
thousendPoint.format(cachedKeys) + 
+                        "\u00a0(~" + SizeUtil.formatSize(cachedSize) + ")");
+                storeSizeList.addChild("li", 
+                        "Stored keys:\u00a0" + thousendPoint.format(storeKeys) 
+ 
+                        "\u00a0(~" + SizeUtil.formatSize(storeSize) + ")");
+                storeSizeList.addChild("li", 
+                        "Overall:\u00a0" + thousendPoint.format(overallKeys) + 
"/" + thousendPoint.format(maxOverallKeys) +
+                        "\u00a0(~" + SizeUtil.formatSize(overallSize) + "/" + 
SizeUtil.formatSize(maxOverallSize) + ")");
             }

             nextTableCell = advancedEnabled ? overviewTableRow.addChild("td") 
: overviewTableRow.addChild("td", "class", "last");


Reply via email to