Author: toad
Date: 2008-02-07 16:54:27 +0000 (Thu, 07 Feb 2008)
New Revision: 17668

Modified:
   trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
Log:
Logging

Modified: trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java      
2008-02-07 16:45:09 UTC (rev 17667)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeULPRTest.java      
2008-02-07 16:54:27 UTC (rev 17668)
@@ -116,8 +116,11 @@

         int successfulTests = 0;

-        for(int totalCount=0;totalCount<256;totalCount++) {
+        long totalPropagationTime = 0;

+        int totalCount = 0;
+        for(totalCount=0;totalCount<256;totalCount++) {
+        
         boolean isSSK = (totalCount & 0x1) == 1;

         // Now create a key.
@@ -176,9 +179,8 @@

         // Store the key to ONE node.

+               long tStart = System.currentTimeMillis();
                nodes[nodes.length-1].store(block, false);
-        
-        // Every 5 seconds, check how many nodes have the key.

                int x = -1;
                while(true) {
@@ -198,7 +200,11 @@
                        }
                        if(count == nodes.length) {
                                successfulTests++;
-                               System.err.println("SUCCESSFUL TEST # 
"+successfulTests+"!!!");
+                               long tEnd = System.currentTimeMillis();
+                               long propagationTime = tEnd-tStart;
+                               System.err.println("SUCCESSFUL TEST # 
"+successfulTests+" in "+propagationTime+"ms!!!");
+                               totalPropagationTime += propagationTime;
+                       System.err.println("Average propagation time: 
"+(totalPropagationTime / (totalCount+1))+"ms");
                                System.err.println();
                                break;
                        }
@@ -213,6 +219,7 @@
                }

         }
+        System.err.println("Overall average propagation time: 
"+(totalPropagationTime / (totalCount+1))+"ms");

     }



Reply via email to