Author: j16sdiz
Date: 2008-06-19 10:52:24 +0000 (Thu, 19 Jun 2008)
New Revision: 20477

Modified:
   
branches/saltedhashstore/freenet/src/freenet/clients/http/StatisticsToadlet.java
   
branches/saltedhashstore/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
   branches/saltedhashstore/freenet/src/freenet/store/FreenetStore.java
   branches/saltedhashstore/freenet/src/freenet/store/RAMFreenetStore.java
   
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
   branches/saltedhashstore/freenet/src/freenet/store/StoreCallback.java
Log:
Show bloom filter false positive


Modified: 
branches/saltedhashstore/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/clients/http/StatisticsToadlet.java
    2008-06-19 10:51:48 UTC (rev 20476)
+++ 
branches/saltedhashstore/freenet/src/freenet/clients/http/StatisticsToadlet.java
    2008-06-19 10:52:24 UTC (rev 20477)
@@ -80,7 +80,8 @@
                peers = node.peers;
        }

-       public String supportedMethods() {
+       @Override
+    public String supportedMethods() {
                return "GET";
        }

@@ -119,7 +120,8 @@
                return count;
        }

-       public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) 
throws ToadletContextClosedException, IOException, RedirectException {
+       @Override
+    public void handleGet(URI uri, HTTPRequest request, ToadletContext ctx) 
throws ToadletContextClosedException, IOException, RedirectException {

                if(!ctx.isAllowedFullAccess()) {
                        super.sendErrorPage(ctx, 403, 
L10n.getString("Toadlet.unauthorizedTitle"), 
L10n.getString("Toadlet.unauthorized"));
@@ -169,8 +171,8 @@
                        contentNode.addChild(core.alerts.createSummary());
                final int mode = 
ctx.getPageMaker().drawModeSelectionArray(core, request, contentNode);

-               double swaps = (double)node.getSwaps();
-               double noSwaps = (double)node.getNoSwaps();
+               double swaps = node.getSwaps();
+               double noSwaps = node.getNoSwaps();

                HTMLNode overviewTable = contentNode.addChild("table", "class", 
"column");
                HTMLNode overviewTableRow = overviewTable.addChild("tr");
@@ -363,9 +365,9 @@
                HTMLNode jvmStatsList = jvmStatsInfoboxContent.addChild("ul");

                Runtime rt = Runtime.getRuntime();
-               float freeMemory = (float) rt.freeMemory();
-               float totalMemory = (float) rt.totalMemory();
-               float maxMemory = (float) rt.maxMemory();
+               float freeMemory = rt.freeMemory();
+               float totalMemory = rt.totalMemory();
+               float maxMemory = rt.maxMemory();

                long usedJavaMem = (long)(totalMemory - freeMemory);
                long allocatedJavaMem = (long)totalMemory;
@@ -439,6 +441,8 @@
                long storeAccesses = storeHits + storeMisses;
                long cacheWrites=node.getChkDatacache().writes();
                long storeWrites=node.getChkDatastore().writes();
+               long cacheFalsePos = 
node.getChkDatacache().getBloomFalsePositive();
+               long storeFalsePos = 
node.getChkDatastore().getBloomFalsePositive();

                // REDFLAG Don't show database version because it's not 
possible to get it accurately.
                // (It's a public static constant, so it will use the version 
from compile time of freenet.jar)
@@ -513,6 +517,11 @@
                row.addChild("td", 
fix1p2.format(1.0*storeWrites/nodeUptimeSeconds)+" /sec");
                row.addChild("td", 
fix1p2.format(1.0*cacheWrites/nodeUptimeSeconds)+" /sec");

+               row = storeSizeTable.addChild("tr");
+               row.addChild("td", "False Pos.");
+               row.addChild("td", thousendPoint.format(storeFalsePos));
+               row.addChild("td", thousendPoint.format(cacheFalsePos));
+               
                // location-based stats
                boolean hasLoc=true;
                double nodeLoc=0.0;
@@ -627,13 +636,13 @@
                        locationSwapList.addChild("li", 
"locChangePerSwap:\u00a0" + fix1p6sci.format(locChangeSession/swaps));
                }
                if ((swaps > 0.0) && (nodeUptimeSeconds >= 60)) {
-                       locationSwapList.addChild("li", 
"locChangePerMinute:\u00a0" + 
fix1p6sci.format(locChangeSession/(double)(nodeUptimeSeconds/60.0)));
+                       locationSwapList.addChild("li", 
"locChangePerMinute:\u00a0" + 
fix1p6sci.format(locChangeSession/(nodeUptimeSeconds/60.0)));
                }
                if ((swaps > 0.0) && (nodeUptimeSeconds >= 60)) {
-                       locationSwapList.addChild("li", "swapsPerMinute:\u00a0" 
+ fix1p6sci.format(swaps/(double)(nodeUptimeSeconds/60.0)));
+                       locationSwapList.addChild("li", "swapsPerMinute:\u00a0" 
+ fix1p6sci.format(swaps/(nodeUptimeSeconds/60.0)));
                }
                if ((noSwaps > 0.0) && (nodeUptimeSeconds >= 60)) {
-                       locationSwapList.addChild("li", 
"noSwapsPerMinute:\u00a0" + 
fix1p6sci.format(noSwaps/(double)(nodeUptimeSeconds/60.0)));
+                       locationSwapList.addChild("li", 
"noSwapsPerMinute:\u00a0" + fix1p6sci.format(noSwaps/(nodeUptimeSeconds/60.0)));
                }
                if ((swaps > 0.0) && (noSwaps > 0.0)) {
                        locationSwapList.addChild("li", 
"swapsPerNoSwaps:\u00a0" + fix1p6sci.format(swaps/noSwaps));
@@ -941,7 +950,7 @@
                int networkSizeEstimateSession = 
stats.getNetworkSizeEstimate(-1);
                int networkSizeEstimate24h = 0;
                int networkSizeEstimate48h = 0;
-               double numberOfRemotePeerLocationsSeenInSwaps = 
(double)node.getNumberOfRemotePeerLocationsSeenInSwaps();
+               double numberOfRemotePeerLocationsSeenInSwaps = 
node.getNumberOfRemotePeerLocationsSeenInSwaps();

                if(nodeUptimeSeconds > (24*60*60)) {  // 24 hours
                        networkSizeEstimate24h = 
stats.getNetworkSizeEstimate(now - (24*60*60*1000));  // 48 hours
@@ -1170,7 +1179,7 @@
                        // Make our own peer stand out from the crowd better so 
we can see it easier
                        offset = -10;
                } else {
-                       offset = (int) (((double) PEER_CIRCLE_INNER_RADIUS) * 
(1.0 - strength));
+                       offset = (int) ((PEER_CIRCLE_INNER_RADIUS) * (1.0 - 
strength));
                }
                double x = PEER_CIRCLE_ADDITIONAL_FREE_SPACE + 
PEER_CIRCLE_RADIUS + Math.sin(peerLocation) * (PEER_CIRCLE_RADIUS - offset);
                double y = PEER_CIRCLE_RADIUS - Math.cos(peerLocation) * 
(PEER_CIRCLE_RADIUS - offset);  // no PEER_CIRCLE_ADDITIONAL_FREE_SPACE for 
y-disposition

Modified: 
branches/saltedhashstore/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/store/BerkeleyDBFreenetStore.java  
    2008-06-19 10:51:48 UTC (rev 20476)
+++ 
branches/saltedhashstore/freenet/src/freenet/store/BerkeleyDBFreenetStore.java  
    2008-06-19 10:52:24 UTC (rev 20477)
@@ -37,7 +37,6 @@

 import freenet.crypt.RandomSource;
 import freenet.keys.KeyVerifyException;
-import freenet.node.NodeInitException;
 import freenet.node.SemiOrderedShutdownHook;
 import freenet.support.Fields;
 import freenet.support.HexUtil;
@@ -1774,14 +1773,16 @@
        */
        private class StoreBlockTupleBinding extends TupleBinding {

-               public void objectToEntry(Object object, TupleOutput to)  {
+               @Override
+        public void objectToEntry(Object object, TupleOutput to)  {
                        StoreBlock myData = (StoreBlock)object;

                        to.writeLong(myData.getOffset());
                        to.writeLong(myData.getRecentlyUsed());
                }

-               public Object entryToObject(TupleInput ti) {
+               @Override
+        public Object entryToObject(TupleInput ti) {
                        long offset = ti.readLong();
                        long lastAccessed = ti.readLong();

@@ -1831,7 +1832,8 @@
        }

        private class ShutdownHook extends Thread {
-               public void run() {
+               @Override
+        public void run() {
                        System.err.println("Closing database due to shutdown.");
                        close(true);
                }
@@ -2303,4 +2305,8 @@
        envConfig.setConfigParam("je.env.backgroundSleepInterval", "10000" /* 
microseconds */); // 10ms
         return envConfig;
     }
+
+       public long getBloomFalsePositive() {
+               return -1;
+       }
 }

Modified: branches/saltedhashstore/freenet/src/freenet/store/FreenetStore.java
===================================================================
--- branches/saltedhashstore/freenet/src/freenet/store/FreenetStore.java        
2008-06-19 10:51:48 UTC (rev 20476)
+++ branches/saltedhashstore/freenet/src/freenet/store/FreenetStore.java        
2008-06-19 10:52:24 UTC (rev 20477)
@@ -53,4 +53,6 @@
        public long writes();

        public long keyCount();
+
+       public long getBloomFalsePositive();
 }

Modified: 
branches/saltedhashstore/freenet/src/freenet/store/RAMFreenetStore.java
===================================================================
--- branches/saltedhashstore/freenet/src/freenet/store/RAMFreenetStore.java     
2008-06-19 10:51:48 UTC (rev 20476)
+++ branches/saltedhashstore/freenet/src/freenet/store/RAMFreenetStore.java     
2008-06-19 10:52:24 UTC (rev 20477)
@@ -57,7 +57,7 @@
        }

        public synchronized long getMaxKeys() {
-               return (long) maxKeys;
+               return maxKeys;
        }

        public synchronized long hits() {
@@ -122,4 +122,7 @@
                return writes;
        }

+       public long getBloomFalsePositive() {
+               return -1;
+       }
 }

Modified: 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-06-19 10:51:48 UTC (rev 20476)
+++ 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-06-19 10:52:24 UTC (rev 20477)
@@ -1383,6 +1383,10 @@
                configLock.readLock().unlock();
                return _storeSize;
        }
+       
+       public long getBloomFalsePositive() {
+               return bloomFalsePos.get();
+       }

        // ------------- Migration
        public void migrationFrom(File storeFile, File keyFile) {

Modified: branches/saltedhashstore/freenet/src/freenet/store/StoreCallback.java
===================================================================
--- branches/saltedhashstore/freenet/src/freenet/store/StoreCallback.java       
2008-06-19 10:51:48 UTC (rev 20476)
+++ branches/saltedhashstore/freenet/src/freenet/store/StoreCallback.java       
2008-06-19 10:52:24 UTC (rev 20477)
@@ -73,6 +73,10 @@
        public long keyCount() {
                return store.keyCount();
        }
+       
+       public long getBloomFalsePositive() {
+               return store.getBloomFalsePositive();
+       }

        /** Generate a routing key from a full key */
        public abstract byte[] routingKeyFromFullKey(byte[] keyBuf);


Reply via email to