Author: robert
Date: 2007-12-27 21:56:35 +0000 (Thu, 27 Dec 2007)
New Revision: 16824
Modified:
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/NodeStats.java
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
Log:
change datastore stats decay rate when changing datastore size
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2007-12-27 21:39:39 UTC (rev
16823)
+++ trunk/freenet/src/freenet/node/Node.java 2007-12-27 21:56:35 UTC (rev
16824)
@@ -1006,6 +1006,9 @@
System.err.println("Caught "+e+" resizing the datastore");
e.printStackTrace();
}
+ //Perhaps a bit hackish...?
Seems like this should be near it's definition in NodeStats.
+
nodeStats.avgStoreLocation.changeMaxReports(maxStoreKeys);
+
nodeStats.avgCacheLocation.changeMaxReports(maxCacheKeys);
}
});
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2007-12-27 21:39:39 UTC
(rev 16823)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2007-12-27 21:56:35 UTC
(rev 16824)
@@ -332,7 +332,8 @@
node.estimateFullHeadersLengthOneMessage();
double nodeLoc=node.lm.getLocation();
- // FIXME PLEASE; (int) casts; (maxCacheKeys>MAXINT?) This value
will probably end up being a small constant anyway (200?).
+ // FIXME PLEASE; (int) casts; (maxCacheKeys>MAXINT?)
+ //Note: If changing the size of avgCacheLocation or
avgStoreLocation, this value is updated in Node.java on changing the store size.
this.avgCacheLocation = new DecayingKeyspaceAverage(nodeLoc,
(int)node.maxCacheKeys, throttleFS == null ? null :
throttleFS.subset("AverageCacheLocation"));
this.avgStoreLocation = new DecayingKeyspaceAverage(nodeLoc,
(int)node.maxStoreKeys, throttleFS == null ? null :
throttleFS.subset("AverageStoreLocation"));
this.avgCacheSuccess = new DecayingKeyspaceAverage(nodeLoc,
10000, throttleFS == null ? null :
throttleFS.subset("AverageCacheSuccessLocation"));
Modified:
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
===================================================================
---
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
2007-12-27 21:39:39 UTC (rev 16823)
+++
trunk/freenet/src/freenet/support/math/BootstrappingDecayingRunningAverage.java
2007-12-27 21:56:35 UTC (rev 16824)
@@ -34,7 +34,7 @@
final double max;
double currentValue;
long reports;
- final int maxReports;
+ int maxReports;
// FIXME: debugging!
long zeros;
long ones;
@@ -103,6 +103,10 @@
return (d * decayFactor) +
(currentValue * (1-decayFactor));
}
+
+ public synchronized void changeMaxReports(int maxReports) {
+ this.maxReports=maxReports;
+ }
int SERIAL_MAGIC = 0xdd60ee7f;
Modified: trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
2007-12-27 21:39:39 UTC (rev 16823)
+++ trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
2007-12-27 21:56:35 UTC (rev 16824)
@@ -81,6 +81,10 @@
throw new IllegalArgumentException("KeyspaceAverage does not
like longs");
}
+ public synchronized void changeMaxReports(int maxReports) {
+ avg.changeMaxReports(maxReports);
+ }
+
public synchronized SimpleFieldSet exportFieldSet(boolean shortLived) {
return avg.exportFieldSet(shortLived);
}