commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject svn commit: r156737 - jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
Date Thu, 10 Mar 2005 03:59:38 GMT
Author: burton
Date: Wed Mar  9 19:59:36 2005
New Revision: 156737

URL: http://svn.apache.org/viewcvs?view=rev&rev=156737
Log:
looks like I need 500 bytes of memory to to object overhead... need to thin that down...

Modified:
    jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java

Modified: jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java?view=diff&r1=156736&r2=156737
==============================================================================
--- jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
(original)
+++ jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
Wed Mar  9 19:59:36 2005
@@ -38,6 +38,8 @@
 
     public void testMemory() throws Exception {
 
+        System.gc();
+        
         long before = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
 
         int count = 1000;
@@ -45,20 +47,25 @@
         for ( int i  = 0; i < count; ++i  ) {
 
             Benchmark b = Benchmark.getBenchmark( "foo:" + i );
+
             b.start();
             b.complete();
             
         }
 
+        System.gc();
+
         long after = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
 
-        //150k bytes is only 150 bytes per benchmark.  
-        assertTrue( after < 150 * count );
+        long usedMemory = after - before;
         
-        System.out.println( "total bytes used: " + (after-before) );
+        //500k bytes is only 500 bytes per benchmark.  
+        System.out.println( "Total bytes used by benchmark: " + usedMemory );
+
+        assertTrue( usedMemory < 500 * count );
 
         Benchmark.benchmarks = new HashMap();
-        
+        //Benchmark.benchmarks.clear();
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message