Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv12788/src/freenet/node/rt
Modified Files:
NGRouting.java NGRoutingTable.java Estimate.java
StandardNodeEstimator.java NodeEstimator.java
Log Message:
6210: Add new diagnostics diffSuccessSearchTime, absDiffSuccessSearchTime,
diffTransferRate, absDiffTransferRate
Index: NGRouting.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/NGRouting.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -r1.20 -r1.21
--- NGRouting.java 4 Nov 2003 19:49:43 -0000 1.20
+++ NGRouting.java 4 Nov 2003 20:29:18 -0000 1.21
@@ -15,6 +15,7 @@
class NGRouting extends TerminatableRouting {
final NGRoutingTable ngrt;
final Estimate list[];
+ Estimate lastEstimate;
NodeEstimator last;
int at = 0;
final int maxSteps;
@@ -62,7 +63,8 @@
terminate(false, true);
return null;
}
- last = list[at].ne;
+ lastEstimate = list[at];
+ last = lastEstimate.ne;
Core.logger.log(this, toString()+".getNextRoute() iteration "+
count+" got "+last+" (estimate "+list[at].value+")",
Logger.DEBUG);
@@ -194,8 +196,17 @@
normalizedTime);
Core.diagnostics.occurrenceContinuous("successSearchTime",
searchTime);
+ long diffSearchTime = searchTime - lastEstimate.searchSuccessTime;
+ Core.diagnostics.occurrenceContinuous("diffSearchSuccessTime",
+ diffSearchTime);
+ Core.diagnostics.occurrenceContinuous("absDiffSearchSuccessTime",
+ Math.abs(diffSearchTime));
if(size > 16384) { // more than one segment
double rate = ((double)size) / ((double)transferTime);
+ double diffRate = rate - lastEstimate.transferRate;
+ Core.diagnostics.occurrenceContinuous("diffTransferRate", diffRate);
+ Core.diagnostics.occurrenceContinuous("absDiffTransferRate",
+ Math.abs(diffRate));
ngrt.reportRate(rate);
Core.diagnostics.occurrenceContinuous("successTransferRate",
((double)size*1000)/
Index: NGRoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/NGRoutingTable.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- NGRoutingTable.java 4 Nov 2003 17:39:20 -0000 1.26
+++ NGRoutingTable.java 4 Nov 2003 20:29:18 -0000 1.27
@@ -284,19 +284,9 @@
int i=0;
while(e.hasMoreElements()) {
NodeEstimator ne = (NodeEstimator)(e.nextElement());
+ Estimate es = ne.longEstimate(k, htl, size, global, pLegitDNF);
long estimate = ne.estimate(k, htl, size,
global, pLegitDNF);
- if(estimate > 24 * 3600 * 1000) {
- if(estimate > 365L * 24L * 3600L * 1000L)
- Core.logger.log(this, "Ludicrous estimated
time: "+
- estimate+" for "+ne,
Logger.ERROR);
- else
- Core.logger.log(this, "Crazy estimated time: "+
- estimate+" for "+ne,
Logger.NORMAL);
- } else if (estimate <= 0)
- Core.logger.log(this, "Unlikely estimated time: 0 for
"+
- ne, Logger.NORMAL);
- Estimate es = new Estimate(ne, estimate);
estimates[i] = es;
i++;
}
Index: Estimate.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Estimate.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- Estimate.java 25 Oct 2003 18:28:00 -0000 1.3
+++ Estimate.java 4 Nov 2003 20:29:18 -0000 1.4
@@ -2,11 +2,17 @@
import freenet.support.Comparable;
class Estimate implements Comparable {
- long value;
- NodeEstimator ne;
- Estimate(NodeEstimator ne, long value) {
+ final long value;
+ final NodeEstimator ne;
+ final long searchSuccessTime;
+ final double transferRate;
+
+ Estimate(NodeEstimator ne, long value, long searchSuccessTime,
+ double transferRate) {
this.ne = ne;
this.value = value;
+ this.searchSuccessTime = searchSuccessTime;
+ this.transferRate = transferRate;
}
public int compareTo(Object o) {
Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -r1.22 -r1.23
--- StandardNodeEstimator.java 4 Nov 2003 17:48:24 -0000 1.22
+++ StandardNodeEstimator.java 4 Nov 2003 20:29:18 -0000 1.23
@@ -142,6 +142,13 @@
public long estimate(Key k, int htl, long size, double requestFailTime,
double pLegitDNF) {
+ Estimate e = longEstimate(k, htl, size, requestFailTime, pLegitDNF);
+ return e.value;
+ }
+
+ public Estimate longEstimate(Key k, int htl, long size, double requestFailTime,
+ double pLegitDNF) {
+ long e;
double estimate = 0F;
// First the simple failures
// would it be better just to remove the connectionFailed stuff... edt
@@ -171,14 +178,14 @@
* (1 - pDNF);
if(pSuccess > 1 || pSuccess < 0) {
Core.logger.log(this, "pSuccess = "+pSuccess, Logger.ERROR);
- return Long.MAX_VALUE;
+ e = Long.MAX_VALUE;
}
double transferRate = etTransferRate.guessTransferRate(k);
if(transferRate == 0.0)
Core.logger.log(this, "Insane transfer rate: "+transferRate+"
on "+
this, Logger.NORMAL);
- double tSuccess =
- etSuccessSearch.guessTime(k) +
+ double tSuccessSearch = etSuccessSearch.guessTime(k);
+ double tSuccess = tSuccessSearch +
(((double)size) / transferRate);
estimate += pSuccess * tSuccess;
@@ -195,9 +202,14 @@
", estimate="+estimate+"ms",
Logger.MINOR);
- long e = (long)estimate;
+ e = (long)estimate;
lastEstimate = e;
- return e;
+ if(e > 24L * 3600L * 1000L || e <= 0) {
+ Core.logger.log(this, "Unreasonable estimate: "+e+" for "+
+ this, Logger.NORMAL);
+ }
+ Estimate es = new Estimate(this, e, (long)tSuccessSearch,
transferRate);
+ return es;
}
public long lastEstimate() {
Index: NodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/NodeEstimator.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- NodeEstimator.java 3 Nov 2003 16:32:25 -0000 1.10
+++ NodeEstimator.java 4 Nov 2003 20:29:18 -0000 1.11
@@ -39,6 +39,8 @@
abstract public long estimate(Key k, int htl, long size,
double
requestFailTime, double pLegitDNF);
+ public abstract Estimate longEstimate(Key k, int htl, long size, double
global, double legitDNF);
+
public String toString() {
return super.toString()+": "+ref;
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs