Author: robert
Date: 2007-12-14 20:04:14 +0000 (Fri, 14 Dec 2007)
New Revision: 16547
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/node/NodeStats.java
Log:
Fix poor memory utilization
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2007-12-14 19:29:48 UTC (rev 16546)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2007-12-14 20:04:14 UTC (rev 16547)
@@ -482,8 +482,8 @@
if (hasLoc) {
storeSizeList.addChild("li", "cacheDist:\u00a0" +
thousendPoint.format(cacheDist));
storeSizeList.addChild("li", "storeDist:\u00a0" +
thousendPoint.format(storeDist));
- long
cacheLocationReports=((SimpleRunningAverage)node.nodeStats.avgCacheLocation).countReports();
- long
storeLocationReports=((SimpleRunningAverage)node.nodeStats.avgStoreLocation).countReports();
+ long
cacheLocationReports=node.nodeStats.avgCacheLocation.countReports();
+ long
storeLocationReports=node.nodeStats.avgStoreLocation.countReports();
double
cachePrimePercent=((1.0*cacheLocationReports)/cachedKeys);
double
storePrimePercent=((1.0*storeLocationReports)/storeKeys);
storeSizeList.addChild("li",
"locStatsReliability:\u00a0"+fix3p1pct.format(cachePrimePercent)+" /
"+fix3p1pct.format(storePrimePercent));
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2007-12-14 19:29:48 UTC
(rev 16546)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2007-12-14 20:04:14 UTC
(rev 16547)
@@ -21,8 +21,8 @@
import freenet.support.api.BooleanCallback;
import freenet.support.api.IntCallback;
import freenet.support.api.LongCallback;
+import freenet.support.math.BootstrappingDecayingRunningAverage;
import freenet.support.math.RunningAverage;
-import freenet.support.math.SimpleRunningAverage;
import freenet.support.math.TimeDecayingRunningAverage;
import freenet.support.math.TrivialRunningAverage;
@@ -186,14 +186,13 @@
this.hardRandom = node.random;
this.routingMissDistance = new TimeDecayingRunningAverage(0.0,
180000, 0.0, 1.0, node);
this.backedOffPercent = new TimeDecayingRunningAverage(0.0,
180000, 0.0, 1.0, node);
- // FIXME PLEASE remove (int) casts
double nodeLoc=node.lm.getLocation();
- this.avgCacheLocation=new
SimpleRunningAverage((int)node.maxCacheKeys, nodeLoc);
- this.avgStoreLocation=new
SimpleRunningAverage((int)node.maxStoreKeys, nodeLoc);
- // FIXME average for success-location may not need to be so
large as the store.
- this.avgCacheSuccess=new SimpleRunningAverage(10000, nodeLoc);
- this.avgStoreSuccess=new SimpleRunningAverage(10000, nodeLoc);
- this.avgRequestLocation=new SimpleRunningAverage(10000,
nodeLoc);
+ // FIXME PLEASE; (int) casts; (maxCacheKeys>MAXINT?) This value
will probably end up being a small constant anyway (200?).
+ this.avgCacheLocation = new
BootstrappingDecayingRunningAverage(nodeLoc, 0.0, 1.0, (int)node.maxCacheKeys,
null);
+ this.avgStoreLocation = new
BootstrappingDecayingRunningAverage(nodeLoc, 0.0, 1.0, (int)node.maxStoreKeys,
null);
+ this.avgCacheSuccess = new
BootstrappingDecayingRunningAverage(nodeLoc, 0.0, 1.0, 10000, null);
+ this.avgStoreSuccess = new
BootstrappingDecayingRunningAverage(nodeLoc, 0.0, 1.0, 10000, null);
+ this.avgRequestLocation = new
BootstrappingDecayingRunningAverage(nodeLoc, 0.0, 1.0, 10000, null);
preemptiveRejectReasons = new StringCounter();
localPreemptiveRejectReasons = new StringCounter();
pInstantRejectIncoming = new TimeDecayingRunningAverage(0,
60000, 0.0, 1.0, node);
@@ -203,18 +202,6 @@
throttledPacketSendAverage =
new TimeDecayingRunningAverage(1, 10*60*1000 /* should
be significantly longer than a typical transfer */, 0, Long.MAX_VALUE, node);
nodePinger = new NodePinger(node);
-
- // FIXME: data-store/cache averages need to be persisted to be
valuable (or scanned at every launch).
- /*
- if (node.isAdvancedModeEnabled()) {
- //Uggghh....
- System.err.println("Scanning datastore/cache for
location values");
- chkDatastore.kludgeScan(avgStoreLocation);
- sskDatastore.kludgeScan(avgStoreLocation);
- chkDatacache.kludgeScan(avgCacheLocation);
- sskDatacache.kludgeScan(avgCacheLocation);
- }
- */
previous_input_stat = 0;
previous_output_stat = 0;