Author: bback
Date: 2006-10-05 18:56:37 +0000 (Thu, 05 Oct 2006)
New Revision: 10615

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
added cache and store hits stats

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-05 18:44:26 UTC (rev 10614)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2006-10-05 18:56:37 UTC (rev 10615)
@@ -361,16 +361,33 @@

                 long maxCachedKeys = node.getChkDatacache().getMaxKeys();
                 long maxStoreKeys = node.getChkDatastore().getMaxKeys();
-                long maxOverallKeys = maxCachedKeys+maxStoreKeys;
+                long maxOverallKeys = maxCachedKeys + maxStoreKeys;
                 long maxOverallSize = maxOverallKeys * fix32kb;

+                long cachedStoreHits = node.getChkDatacache().hits();
+                long cachedStoreMisses = node.getChkDatacache().misses();
+                long storeHits = node.getChkDatastore().hits();
+                long storeMisses = node.getChkDatastore().misses();
+                
                 storeSizeList.addChild("li", 
                         "Cached keys:\u00a0" + 
thousendPoint.format(cachedKeys) + 
                         "\u00a0(~" + SizeUtil.formatSize(cachedSize) + ")");
+
                 storeSizeList.addChild("li", 
+                        "Cache hits:\u00a0" + 
thousendPoint.format(cachedStoreHits) + 
+                        
"\u00a0/\u00a0"+thousendPoint.format(cachedStoreHits+cachedStoreMisses) +
+                        "\u00a0(" + ((cachedStoreHits*100) / 
(cachedStoreHits+cachedStoreMisses)) + "%)");
+                
+                storeSizeList.addChild("li", 
                         "Stored keys:\u00a0" + thousendPoint.format(storeKeys) 
+ 
                         "\u00a0(~" + SizeUtil.formatSize(storeSize) + ")");
+                
                 storeSizeList.addChild("li", 
+                        "Store hits:\u00a0" + thousendPoint.format(storeHits) 
+ 
+                        
"\u00a0/\u00a0"+thousendPoint.format(storeHits+storeMisses) +
+                        "\u00a0(" + ((storeHits*100) / 
(storeHits+storeMisses)) + "%)");
+
+                storeSizeList.addChild("li", 
                         "Overall:\u00a0" + thousendPoint.format(overallKeys) + 
"/" + thousendPoint.format(maxOverallKeys) +
                         "\u00a0(~" + SizeUtil.formatSize(overallSize) + "/" + 
SizeUtil.formatSize(maxOverallSize) + ")");
             }

Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-10-05 
18:44:26 UTC (rev 10614)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java 2006-10-05 
18:56:37 UTC (rev 10615)
@@ -66,11 +66,11 @@
        private final TupleBinding longTupleBinding;
        private final File fixSecondaryFile;

-       private long chkBlocksInStore;
+       private long chkBlocksInStore = 0;
        private final Object chkBlocksInStoreLock = new Object();
        private long maxChkBlocks;
-       private long hits;
-       private long misses;
+       private long hits = 0;
+       private long misses = 0;
        private final Database chkDB;
        private final SecondaryDatabase chkDB_accessTime;
        private final SecondaryDatabase chkDB_blockNum;


Reply via email to