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

Modified Files:
        StandardNodeEstimator.java ResponseTimeEstimator.java 
Log Message:
6312: Fix tTransferRate formatFromRaw() - show bytes per second NOT PER MILLISECOND.
Also minor clarification in StandardNodeEstimator.

Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -r1.23 -r1.24
--- StandardNodeEstimator.java  4 Nov 2003 20:29:18 -0000       1.23
+++ StandardNodeEstimator.java  4 Nov 2003 22:07:26 -0000       1.24
@@ -166,7 +166,7 @@
                double pDNF = 
                        epDNFGivenConnectionAndNotRejectedOrSearchFailed.
                        guessProbability(k);
-               if (pDNF==0)
+               if (pDNF==0.0)
                        pDNF = pLegitDNF;
                double tDNF = etDNF.guessTime(k) * htl;
                double pNotConnectFailedOrSearchFailed =

Index: ResponseTimeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/ResponseTimeEstimator.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -w -r1.35 -r1.36
--- ResponseTimeEstimator.java  4 Nov 2003 21:55:13 -0000       1.35
+++ ResponseTimeEstimator.java  4 Nov 2003 22:07:27 -0000       1.36
@@ -389,6 +389,10 @@
        //range 0.0 to 1.0, so we can use lots of bits
     }
     
+    /**
+     * Guess the expected transfer rate for a given key.
+     * @returns the transfer rate in bytes per MILLISECOND
+     */
     public double guessTransferRate(Key k) {
        int x = guess(k);
        double p = ((double)x) / (16*1000);
@@ -712,8 +716,11 @@
                                if(x > Integer.MAX_VALUE) throw new 
IllegalArgumentException("to big probability");
                                return nf.format(intToProbability((int)x));
                        }
-                       if(type == TRANSFER_RATE) 
-                               return nf.format(((double)x) / (16*1000)) + 
"bytes/second";
+                       if(type == TRANSFER_RATE) {
+                               nf.setMaximumFractionDigits(0);
+                               return nf.format((int)(x/16)) + " bytes/second";
+                       }
+                       // 16*1000 would be bytes per MILLISECOND. We want bytes/sec
                        throw new IllegalArgumentException("unknown type");
                }
                private GraphDataSet generateGraphData(int samples,BigInteger 
keyspaceStepLength, int age){

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

Reply via email to