Author: robert
Date: 2007-12-27 21:39:39 +0000 (Thu, 27 Dec 2007)
New Revision: 16823

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
cap distance stat at 100% (now that it's persisted)


Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-12-27 21:14:15 UTC (rev 16822)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2007-12-27 21:39:39 UTC (rev 16823)
@@ -529,10 +529,17 @@
                        long 
cacheLocationReports=node.nodeStats.avgCacheLocation.countReports();
                        long 
storeLocationReports=node.nodeStats.avgStoreLocation.countReports();

+                       double storePercent=1.0*storeLocationReports/storeKeys;
+                       double cachePercent=1.0*cacheLocationReports/cachedKeys;
+                       
+                       //Cap the reported value at 100%, as the decaying 
average does not account beyond that anyway.
+                       if (storePercent>1.0) storePercent=1.0;
+                       if (cachePercent>1.0) cachePercent=1.0;
+                       
                        row=storeSizeTable.addChild("tr");
                        row.addChild("td", "Distance Stats");
-                       row.addChild("td", 
fix3p1pct.format(1.0*storeLocationReports/storeKeys));
-                       row.addChild("td", 
fix3p1pct.format(1.0*cacheLocationReports/cachedKeys));
+                       row.addChild("td", fix3p1pct.format(storePercent));
+                       row.addChild("td", fix3p1pct.format(cachePercent));
                }

        }


Reply via email to