Update of /cvsroot/freenet/freenet/src/freenet/diagnostics
In directory sc8-pr-cvs1:/tmp/cvs-serv8807/src/freenet/diagnostics

Modified Files:
      Tag: stable
        AutoPoll.java Binomial.java BinomialVarEvent.java 
        Continuous.java ContinuousVarEvent.java CountingProcess.java 
        Diagnostics.java DiagnosticsTest.java FieldSetFormat.java 
        FileEventList.java RandomVar.java RowDiagnosticsFormat.java 
        StandardDiagnostics.java VarEvent.java VoidDiagnostics.java 
Log Message:
5030: Merge minor(ish) changes from unstable:
Open Connections infolet
     Minor implementation changes on normal mode
     Show total bytes transmitted/received so far
     Much new information on the PeerHandler mode
Fixed tons of eclipse warnings (almost all are style issues, not functional changes - 
relating to logger and imports mostly). Remove deprecated FieldSet.add(String,String).
      Update TestLocalNIOInterface to current API
Make 5029 mandatory (it can't connect to us anyway, only vice versa).
If incoming HTL is 25, 50% chance of not decrementing it, so we have some plausible 
deniability when we send out an HTL 25 request (the client level HTL perturb mechanism 
is insufficient although useful).
Don't use seednodes with no physical address.
Use our own URLEncoder/URLDecoder's, catch the exceptions. We were using java's, which 
are deprecated.
Add support for deprecated options. These will be read form config file and handled, 
but will not be written to it by --config. Currently bandwidthLimit and 
averageBandwidthLimit are in this category. Separate code logs an error when these are 
set.
Change the way bandwidthLimit set but others not set, to prevent it from constantly 
getting 100% load due to bandwidth limit (0!) exceeded.
Set priority of entropy thread to MIN.
Remove old datastore code, GOOD RIDDENS!
Add a memory usage test for the Failure Table
Increase size of failure table to 20,000 (from 2,000).
Don't show the key request form in simple mode on the default infolet.
Major refactoring of HTML reporting, writing to disk, in NGRouting estimators.
Relative times in (for example) ?date= in fproxy: ?date=-1year gives the edition of a 
DBR one year ago.
NIO refactoring (ASL.ChannelAttachmentPairQueue).
Logging.


Index: AutoPoll.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/AutoPoll.java,v
retrieving revision 1.4.6.1
retrieving revision 1.4.6.2
diff -u -w -r1.4.6.1 -r1.4.6.2
--- AutoPoll.java       15 Jul 2003 14:29:39 -0000      1.4.6.1
+++ AutoPoll.java       1 Nov 2003 16:55:26 -0000       1.4.6.2
@@ -178,7 +178,7 @@
                   p.getValue() instanceof Integer)) {
                 logger.log(this, "Binomial expects returned pair to contain"
                            + " Integers, but got " + p.getKey().getClass() 
-                           + " and " + p.getValue().getClass(), logger.NORMAL);
+                           + " and " + p.getValue().getClass(), Logger.NORMAL);
                 return;
             }
             

Index: Binomial.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/Binomial.java,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -w -r1.7 -r1.7.4.1
--- Binomial.java       27 Oct 2002 14:30:41 -0000      1.7
+++ Binomial.java       1 Nov 2003 16:55:27 -0000       1.7.4.1
@@ -1,10 +1,7 @@
 package freenet.diagnostics;
-import freenet.support.Fields;
-import freenet.FieldSet;
-import java.util.Enumeration;
-import java.io.DataOutputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.util.Enumeration;
 /**
  * Implementation of a the binomial random var.
  *

Index: BinomialVarEvent.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/BinomialVarEvent.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -w -r1.2 -r1.2.4.1
--- BinomialVarEvent.java       27 Oct 2002 14:30:41 -0000      1.2
+++ BinomialVarEvent.java       1 Nov 2003 16:55:28 -0000       1.2.4.1
@@ -1,9 +1,5 @@
 package freenet.diagnostics;
-import freenet.support.Fields;
-import freenet.FieldSet;
-import java.util.Enumeration;
 import java.io.DataOutputStream;
-import java.io.DataInputStream;
 import java.io.IOException;
 /**
  * Implementation of a the binomial random var.

Index: Continuous.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/Continuous.java,v
retrieving revision 1.8
retrieving revision 1.8.6.1
diff -u -w -r1.8 -r1.8.6.1
--- Continuous.java     25 Jul 2002 00:03:46 -0000      1.8
+++ Continuous.java     1 Nov 2003 16:55:28 -0000       1.8.6.1
@@ -1,12 +1,7 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
-import freenet.support.Fields;
-import java.util.Enumeration;
-import java.util.Date;
-import java.text.DateFormat;
-import java.io.DataOutputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.util.Enumeration;
 
 /**
  * Implementation of a the continuous random var.

Index: ContinuousVarEvent.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/ContinuousVarEvent.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -w -r1.2 -r1.2.4.1
--- ContinuousVarEvent.java     27 Oct 2002 11:12:06 -0000      1.2
+++ ContinuousVarEvent.java     1 Nov 2003 16:55:28 -0000       1.2.4.1
@@ -1,11 +1,5 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
-import freenet.support.Fields;
-import java.util.Enumeration;
-import java.util.Date;
-import java.text.DateFormat;
 import java.io.DataOutputStream;
-import java.io.DataInputStream;
 import java.io.IOException;
 
 /**

Index: CountingProcess.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/CountingProcess.java,v
retrieving revision 1.8
retrieving revision 1.8.6.1
diff -u -w -r1.8 -r1.8.6.1
--- CountingProcess.java        25 Jul 2002 00:03:46 -0000      1.8
+++ CountingProcess.java        1 Nov 2003 16:55:28 -0000       1.8.6.1
@@ -1,10 +1,7 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
-import freenet.support.Fields;
-import java.util.Enumeration;
-import java.io.DataOutputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.util.Enumeration;
 /**
  * Implementation of the counting process.
  *

Index: Diagnostics.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/Diagnostics.java,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -w -r1.6 -r1.6.6.1
--- Diagnostics.java    23 Jul 2002 04:51:17 -0000      1.6
+++ Diagnostics.java    1 Nov 2003 16:55:28 -0000       1.6.6.1
@@ -1,6 +1,4 @@
 package freenet.diagnostics;
-import freenet.support.*;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.reflect.Field;
 

Index: DiagnosticsTest.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/DiagnosticsTest.java,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -w -r1.6 -r1.6.6.1
--- DiagnosticsTest.java        27 Feb 2002 23:32:18 -0000      1.6
+++ DiagnosticsTest.java        1 Nov 2003 16:55:28 -0000       1.6.6.1
@@ -1,11 +1,11 @@
 package freenet.diagnostics;
-import freenet.support.*;
-import freenet.support.io.NullOutputStream;
-import freenet.support.io.WriteOutputStream;
-import junit.framework.*;
-import freenet.FieldSet;
 import java.io.PrintWriter;
-import java.io.IOException;
+
+import junit.framework.TestCase;
+import freenet.FieldSet;
+import freenet.support.Fields;
+import freenet.support.Logger;
+import freenet.support.io.NullOutputStream;
 /**
  * A unit test class containing some tests of the Freenet diagnostics
  * module.
@@ -33,19 +33,19 @@
     }
 
     public void testGeneral() {
-        assertEquals("Testing minute length",diag.getPeriod(diag.MINUTE),
+        assertEquals("Testing minute 
length",Diagnostics.getPeriod(Diagnostics.MINUTE),
                      60 * 1000);
-        assertEquals("Testing hour length",diag.getPeriod(diag.HOUR),
+        assertEquals("Testing hour length",Diagnostics.getPeriod(Diagnostics.HOUR),
                      60 * 60 * 1000);
-        assertEquals("Testing day length",diag.getPeriod(diag.DAY),
+        assertEquals("Testing day length",Diagnostics.getPeriod(Diagnostics.DAY),
                      24 * 60 * 60 * 1000);
 
         // I can't do much testing here. It runs on the system clock, so
         // there is no way to do a fastforward. I'll just do some things
         // to make sure they don't through errors.
-        diag.registerBinomial("testBin",diag.MINUTE, "Test", null);
-        diag.registerContinuous("testCont",diag.HOUR, "Test", null);
-        diag.registerCounting("testCount",diag.HOUR, "Test", null);
+        diag.registerBinomial("testBin",Diagnostics.MINUTE, "Test", null);
+        diag.registerContinuous("testCont",Diagnostics.HOUR, "Test", null);
+        diag.registerCounting("testCount",Diagnostics.HOUR, "Test", null);
 
         diag.occurrenceBinomial("testBin",10, 1);
         try {
@@ -138,7 +138,7 @@
         assertEquals("Testing X aggregation",
                      Double.valueOf(fs[0]).doubleValue(),
                      100.0 + 200.0, 0.001);
-        assertEquals("Testing X� aggregation",
+        assertEquals("Testing X? aggregation",
                      Double.valueOf(fs[1]).doubleValue(),
                      100.0*100.0 + 200.0*200.0, 0.001);
         assertEquals("Testing N aggregation",Long.parseLong(fs[2]),

Index: FieldSetFormat.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/FieldSetFormat.java,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -w -r1.5 -r1.5.6.1
--- FieldSetFormat.java 10 Mar 2002 22:50:29 -0000      1.5
+++ FieldSetFormat.java 1 Nov 2003 16:55:28 -0000       1.5.6.1
@@ -4,6 +4,7 @@
 import java.io.IOException;
 import freenet.support.io.WriteOutputStream;
 import freenet.support.Fields;
+import freenet.support.Logger;
 import freenet.FieldSet;
 import freenet.Core;
 
@@ -56,7 +57,7 @@
             return bytes.toString("UTF8");
         } catch (IOException e) {
             Core.logger.log(this, "Error when writing to mem buffer.",e,
-                            Core.logger.ERROR);
+                            Logger.ERROR);
             return "";
         }
     }
@@ -76,13 +77,13 @@
                 for (Enumeration e = el.elements();
                      e.hasMoreElements() ;) {
                     VarEvent ev = (VarEvent) e.nextElement();
-                    stats.add(Long.toString(ev.time()),
+                    stats.put(Long.toString(ev.time()),
                               Fields.commaList(ev.fields()));
                 }
                 if (i < 0) {
-                    fs.add("occurrences", stats);
+                    fs.put("occurrences", stats);
                 } else {          
-                    fs.add(StandardDiagnostics.getName(aggPeriod + i), 
+                    fs.put(StandardDiagnostics.getName(aggPeriod + i), 
                            stats);
                 }
                 el.close();

Index: FileEventList.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/FileEventList.java,v
retrieving revision 1.1.1.1.4.1.2.1
retrieving revision 1.1.1.1.4.1.2.2
diff -u -w -r1.1.1.1.4.1.2.1 -r1.1.1.1.4.1.2.2
--- FileEventList.java  28 Oct 2003 20:20:31 -0000      1.1.1.1.4.1.2.1
+++ FileEventList.java  1 Nov 2003 16:55:28 -0000       1.1.1.1.4.1.2.2
@@ -108,7 +108,7 @@
         } catch (IOException e) {
             Core.logger.log(this, 
                             "Failed to write data to disk, not overwriting", 
-                            e, Core.logger.ERROR);
+                            e, Logger.ERROR);
             return false;
         } finally {
            if(out != null) {
@@ -136,7 +136,7 @@
         } catch (IOException e) {
             Core.logger.log(this, 
                             "Failed to read data from disk, using empty file.",
-                            e, Core.logger.ERROR);
+                            e, Logger.ERROR);
             return new DoublyLinkedListImpl();
         } finally {
            if(in != null) {

Index: RandomVar.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/RandomVar.java,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -w -r1.6 -r1.6.6.1
--- RandomVar.java      25 Jul 2002 00:03:46 -0000      1.6
+++ RandomVar.java      1 Nov 2003 16:55:28 -0000       1.6.6.1
@@ -1,17 +1,10 @@
 package freenet.diagnostics;
-import freenet.support.*;
-import freenet.FieldSet;
+import java.io.DataInputStream;
+import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.util.Enumeration;
-import java.util.Vector;
 import java.util.Hashtable;
-import java.util.Date;
-import java.text.DateFormat;
-import java.text.FieldPosition;
-import java.text.ParsePosition;
-import java.io.DataOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
+import java.util.Vector;
 /**
  * Superclass of different types of variables.
  *

Index: RowDiagnosticsFormat.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/RowDiagnosticsFormat.java,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -w -r1.5 -r1.5.6.1
--- RowDiagnosticsFormat.java   10 Mar 2002 22:50:29 -0000      1.5
+++ RowDiagnosticsFormat.java   1 Nov 2003 16:55:28 -0000       1.5.6.1
@@ -1,5 +1,4 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
 import java.util.Enumeration;
 import java.util.Stack;
 /**

Index: StandardDiagnostics.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/StandardDiagnostics.java,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.1.2.1
diff -u -w -r1.6.4.1 -r1.6.4.1.2.1
--- StandardDiagnostics.java    4 Nov 2002 18:46:28 -0000       1.6.4.1
+++ StandardDiagnostics.java    1 Nov 2003 16:55:28 -0000       1.6.4.1.2.1
@@ -1,17 +1,21 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
-import freenet.Core;
-import freenet.support.*;
-import freenet.support.io.WriteOutputStream;
-import freenet.support.io.ReadInputStream;
-import java.util.*;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+import freenet.support.Logger;
+
 /**
  * The standard Diagnostics implementation.
  *
  * @author oskar
  */
-
 public class StandardDiagnostics extends Diagnostics {
 
     static final long y2k;
@@ -82,7 +86,7 @@
             logger.log(this, "Sorry, my time traveling friend, " 
                        + "diagnostics cannot function before Jan 1st 2000. " 
                        + "Don't worry though, Freenet works fine without " 
-                         + "diagnostics.", logger.NORMAL);
+                         + "diagnostics.", Logger.NORMAL);
             throw new DiagnosticsException("Diagnostics requires date > " 
                                            + (new Date(y2k)).toString());
         }
@@ -131,10 +135,10 @@
     public void occurrenceBinomial(String name, long n, long x) {
         Object o = vars.get(name);
         if (o == null || !(o instanceof Binomial)) {
-            logger.log(this, name + " is not binomial var.", logger.ERROR);
+            logger.log(this, name + " is not binomial var.", Logger.ERROR);
         } else if (x > n) {
             logger.log(this, "Outcome cannot be greater than value in a " 
-                       + "binomial dist,", logger.ERROR);
+                       + "binomial dist,", Logger.ERROR);
         } else {
             ((Binomial) o).add(clock.currentTimeMillis(), n, x, lastTime);
         }
@@ -156,7 +160,7 @@
         Object o = vars.get(name);
         if (o == null || !(o instanceof Continuous)) {
             logger.log(this, name + " not a continuous variable.",
-                       logger.ERROR);
+                       Logger.ERROR);
         } else {
             ((Continuous) o).add(clock.currentTimeMillis(), value, lastTime);
         }
@@ -178,7 +182,7 @@
         Object o = vars.get(name);
         if (o == null || !(o instanceof CountingProcess)) {
             logger.log(this, name + " is not a counting process.",
-                       logger.ERROR);       
+                       Logger.ERROR);       
         } else {
             ((CountingProcess) o).add(clock.currentTimeMillis(), n, lastTime);
         }
@@ -200,7 +204,7 @@
                        + (new Date(time)).toString() 
                        + "! I can probably handle this, but if you get " 
                        + "trouble consider turning off Diagnostics.",
-                       logger.NORMAL);
+                       Logger.NORMAL);
         }
         long[] tperiods;
         // iterate over minutes since minute following last run
@@ -211,9 +215,9 @@
              c.add(Calendar.MINUTE, 1)) {
 
             tperiods = getPeriods(c);
-            if (logger.shouldLog(logger.DEBUG))
+            if (logger.shouldLog(Logger.DEBUG))
                 logger.log(this, tperiods.length + " periods ending at time " 
-                           + c.getTime() + " currently " + time, logger.DEBUG);
+                           + c.getTime() + " currently " + time, Logger.DEBUG);
             for (Enumeration e = vars.elements() ; e.hasMoreElements() ;) {
                 RandomVar rv = (RandomVar) e.nextElement();
                 for (int i = 0 ; i < tperiods.length ; i++) {
@@ -278,7 +282,7 @@
             } catch (IOException e) {
                 logger.log(this, 
                            "Failed to create stat file, reverting to memory", 
-                           e, logger.NORMAL);
+                           e, Logger.NORMAL);
                 return new LinkedEventList();
             }
     }
@@ -301,17 +305,17 @@
                 if (FileEventList.isCached(statsDir, name, type)) {
                     logger.log(this, "Found file for var " + name +
                                " type: " + type,
-                               logger.DEBUG);
+                               Logger.DEBUG);
                     return new FileEventList(statsDir, name, type);
                 } else {
                     logger.log(this, "Did NOT find file for var " + name +
                                " type: " + type,
-                               logger.DEBUG);
+                               Logger.DEBUG);
                     return null;
                 }
             } catch (IOException e) {
                 logger.log(this, "Failed to read cached stats - data lost?",
-                           e, logger.NORMAL);
+                           e, Logger.NORMAL);
                 return null;
             }
         }

Index: VarEvent.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/VarEvent.java,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -w -r1.4 -r1.4.6.1
--- VarEvent.java       13 Feb 2002 00:39:47 -0000      1.4
+++ VarEvent.java       1 Nov 2003 16:55:28 -0000       1.4.6.1
@@ -1,10 +1,8 @@
 package freenet.diagnostics;
-import freenet.support.*;
-import freenet.support.DoublyLinkedList.Item;
-import freenet.FieldSet;
-import java.util.Date;
 import java.io.DataOutputStream;
 import java.io.IOException;
+
+import freenet.support.DoublyLinkedList.Item;
 /**
  * Superclass of occurrence descriptions for random variables.
  */

Index: VoidDiagnostics.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/diagnostics/VoidDiagnostics.java,v
retrieving revision 1.6
retrieving revision 1.6.6.1
diff -u -w -r1.6 -r1.6.6.1
--- VoidDiagnostics.java        13 Feb 2002 01:00:53 -0000      1.6
+++ VoidDiagnostics.java        1 Nov 2003 16:55:28 -0000       1.6.6.1
@@ -1,9 +1,9 @@
 package freenet.diagnostics;
-import freenet.FieldSet;
-import freenet.support.*;
-import freenet.support.io.ReadInputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
+
+import freenet.FieldSet;
+import freenet.support.io.ReadInputStream;
 
 /**
  * A diagnostics implementation that eats all values and does nothing.

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

Reply via email to