Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv20915/src/freenet/node/rt

Modified Files:
        StandardNodeStats.java StandardNodeEstimator.java 
Log Message:
6356:
For times used in estimators, pessimistic default is based on max(min time), or 
min(max rate). This prevents exponential pessimism, which was causing estimators to 
die on restart, and probably worse things.
Increment the Estimator FieldSet version again to avoid pollution from older nodes.
Add stat rtStatsMinTransferRate.


Index: StandardNodeStats.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeStats.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- StandardNodeStats.java      25 Nov 2003 02:21:12 -0000      1.4
+++ StandardNodeStats.java      25 Nov 2003 15:56:00 -0000      1.5
@@ -30,6 +30,7 @@
                Core.diagnostics.occurrenceContinuous("rtStatsMaxSuccessSearchTime", 
maxSuccessSearchTime);
                Core.diagnostics.occurrenceContinuous("rtStatsMaxPTransferFailed", 
maxPTransferFailed);
                Core.diagnostics.occurrenceContinuous("rtStatsMaxTransferFailedTime", 
maxTransferFailedTime);
+               Core.diagnostics.occurrenceContinuous("rtStatsMinTransferRate", 
minTransferRate);
        }
        
        public String toString() {
@@ -99,13 +100,22 @@
                d = ne.tSearchFailed();
                if(maxSearchFailedTime < d)
                        maxSearchFailedTime = d;
-               d = ne.maxTSuccessSearch();
+               
+               // These two use the minimum value, because they are doubled up in new 
nodes
+               // This is because higher is worse.
+               // They are the only two estimator times used
+               d = ne.minTSuccessSearch();
                if(maxSuccessSearchTime < d)
                        maxSuccessSearchTime = d;
-               d = ne.maxDNFTime();
+               d = ne.minDNFTime();
                if(maxDNFTime < d)
                        maxDNFTime = d;
-               d = ne.minTransferRate();
+               
+               // Estimator for transfer rate. Higher is better.
+               // To prevent cascading downwards, take the min of the maxima
+               // This should still be adequate since we initialize to
+               // { minTransferRate , minTransferRate / 2 }
+               d = ne.maxTransferRate();
                if(minTransferRate > d)
                        minTransferRate = d;
        }

Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -w -r1.53 -r1.54
--- StandardNodeEstimator.java  25 Nov 2003 13:54:34 -0000      1.53
+++ StandardNodeEstimator.java  25 Nov 2003 15:56:00 -0000      1.54
@@ -91,19 +91,34 @@
                                etSuccessSearch.highestRaw(), TimeEstimator.TIME);
        }
        
+       public double minTSuccessSearch() {
+               return etSuccessSearch.convertFromRaw(
+                               etSuccessSearch.lowestRaw(), TimeEstimator.TIME);
+       }
+       
        public double maxDNFTime() {
                return etDNF.convertFromRaw(
                                etDNF.highestRaw(), TimeEstimator.TIME);
        }
        
+       public double minDNFTime() {
+               return etDNF.convertFromRaw(
+                               etDNF.lowestRaw(), TimeEstimator.TIME);
+       }
+       
        public double minTransferRate() {
                return etTransferRate.convertFromRaw(etTransferRate.lowestRaw(),
                                TimeEstimator.TRANSFER_RATE);
        }
        
+       public double maxTransferRate() {
+               return etTransferRate.convertFromRaw(etTransferRate.highestRaw(),
+                               TimeEstimator.TRANSFER_RATE);
+       }
+       
        public FieldSet toFieldSet() {
                FieldSet fs = new FieldSet();
-               fs.put("Version", "4");
+               fs.put("Version", "5");
                fs.put("rpConnectFailed", rpConnectFailed.toFieldSet());
                fs.put("rpTransferFailed", rpTransferFailed.toFieldSet());
                fs.put("rpSearchFailed", rpSearchFailed.toFieldSet());
@@ -210,7 +225,7 @@
                                if(v == null) throw new EstimatorFormatException("no 
Version");
                                try {
                                        int version = Fields.hexToInt(v);
-                                       if(version != 4) 
+                                       if(version != 5) 
                                                throw new 
EstimatorFormatException("Unsupported version "+version, false);
                                } catch (NumberFormatException ex) {
                                        EstimatorFormatException ee = new 
EstimatorFormatException("Odd version: "+v+" ("+ex+")");

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to