db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/performance PerfTest.java
Date Sat, 03 Sep 2005 18:03:33 GMT
arminw      2005/09/03 11:03:33

  Modified:    src/test/org/apache/ojb/compare PerformanceBaseTest.java
                        PerformanceODMGTest.java PerformanceOTMTest.java
                        PerformancePBTest.java
               src/test/org/apache/ojb/performance PerfTest.java
  Log:
  minor improvements
  
  Revision  Changes    Path
  1.3       +1 -2      db-ojb/src/test/org/apache/ojb/compare/PerformanceBaseTest.java
  
  Index: PerformanceBaseTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/PerformanceBaseTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PerformanceBaseTest.java	27 Aug 2005 12:41:20 -0000	1.2
  +++ PerformanceBaseTest.java	3 Sep 2005 18:03:33 -0000	1.3
  @@ -61,8 +61,7 @@
               arr = new PerformanceArticle[articleCount];
               for(int i = 0; i < articleCount; i++)
               {
  -                PerformanceArticle a = createArticle(offsetId + i);
  -                arr[i] = a;
  +                arr[i] = createArticle(offsetId + i);
               }
           }
           catch(Exception e)
  
  
  
  1.4       +0 -4      db-ojb/src/test/org/apache/ojb/compare/PerformanceODMGTest.java
  
  Index: PerformanceODMGTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/PerformanceODMGTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PerformanceODMGTest.java	31 Aug 2005 16:30:47 -0000	1.3
  +++ PerformanceODMGTest.java	3 Sep 2005 18:03:33 -0000	1.4
  @@ -4,7 +4,6 @@
   import java.util.Iterator;
   
   import org.apache.ojb.broker.TestHelper;
  -import org.apache.ojb.odmg.OJB;
   import org.apache.ojb.odmg.TransactionExt;
   import org.odmg.Database;
   import org.odmg.Implementation;
  @@ -143,9 +142,6 @@
           // we don't want implicite locks when compare performance
           tx.setImplicitLocking(false);
           tx.begin();
  -        // clear cache to read from DB
  -        tx.getBroker().clearCache();
  -
           long start = System.currentTimeMillis();
           OQLQuery query = odmg.newOQLQuery();
           String sql = "select allArticles from " + PerformanceArticle.class.getName()
  
  
  
  1.3       +0 -6      db-ojb/src/test/org/apache/ojb/compare/PerformanceOTMTest.java
  
  Index: PerformanceOTMTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/PerformanceOTMTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PerformanceOTMTest.java	27 Aug 2005 12:41:20 -0000	1.2
  +++ PerformanceOTMTest.java	3 Sep 2005 18:03:33 -0000	1.3
  @@ -54,12 +54,6 @@
   
           _kit = TestKit.getTestInstance();
           _conn = _kit.acquireConnection(ojb.getDefaultConfiguration());
  -        arr = new PerformanceArticle[articleCount];
  -        for(int i = 0; i < articleCount; i++)
  -        {
  -            PerformanceArticle a = createArticle(offsetId + i);
  -            arr[i] = a;
  -        }
       }
   
       public void tearDown() throws Exception
  
  
  
  1.3       +3 -3      db-ojb/src/test/org/apache/ojb/compare/PerformancePBTest.java
  
  Index: PerformancePBTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/compare/PerformancePBTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PerformancePBTest.java	27 Aug 2005 12:41:20 -0000	1.2
  +++ PerformancePBTest.java	3 Sep 2005 18:03:33 -0000	1.3
  @@ -4,9 +4,9 @@
   
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.OJB;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
  -import org.apache.ojb.broker.util.ObjectModificationDefaultImpl;
   
   /**
    * This TestCase contains the OJB single-threaded performance benchmarks for the
  @@ -76,7 +76,7 @@
           broker.beginTransaction();
           for(int i = 0; i < articleCount; i++)
           {
  -            broker.store(arr[i], ObjectModificationDefaultImpl.INSERT);
  +            broker.store(arr[i], OJB.INSERT);
           }
           broker.commitTransaction();
           long stop = System.currentTimeMillis();
  @@ -149,7 +149,7 @@
           broker.beginTransaction();
           for(int i = 0; i < articleCount; i++)
           {
  -            broker.store(arr[i], ObjectModificationDefaultImpl.UPDATE);
  +            broker.store(arr[i], OJB.UPDATE);
           }
           broker.commitTransaction();
           long stop = System.currentTimeMillis();
  
  
  
  1.12      +14 -7     db-ojb/src/test/org/apache/ojb/performance/PerfTest.java
  
  Index: PerfTest.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/performance/PerfTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PerfTest.java	27 Aug 2005 12:44:03 -0000	1.11
  +++ PerfTest.java	3 Sep 2005 18:03:33 -0000	1.12
  @@ -112,7 +112,7 @@
           threads = new Thread[runnables.length];
           for (int i = 0; i < threads.length; i++)
           {
  -            threads[i] = new Thread(runnables[i]);
  +            threads[i] = new Thread(threadGroup, runnables[i]);
           }
           for (int i = 0; i < threads.length; i++)
           {
  @@ -129,6 +129,13 @@
           {
               System.out.println(PREFIX_LOG + "Thread join interrupted.");
           }
  +
  +        // should always be skipped, because we use 'thread.join'
  +        while(threadGroup.activeCount() > 0)
  +        {
  +            System.out.println("## active threads: " + threadGroup.activeCount());
  +        }
  +
           threads = null;
       }
   
  @@ -142,8 +149,8 @@
                   System.out.println("# Start PerfTest: " + testName() + " #");
               }
   
  -            int objectCount = 0;
  -            int objectCountAfter = 0;
  +            int objectCount;
  +            int objectCountAfter;
   
               testTimes = new long[5];
   
  @@ -153,8 +160,7 @@
               PerfHandle[] perfHandles = new PerfHandle[PerfMain.getConcurrentThreads()];
               for (int i = 0; i < PerfMain.getConcurrentThreads(); i++)
               {
  -                PerfHandle ph = newPerfHandle(this);
  -                perfHandles[i] = ph;
  +                perfHandles[i] = newPerfHandle(this);
               }
               testTimes[0] = System.currentTimeMillis();
               runTestHandles(perfHandles);
  @@ -179,7 +185,8 @@
   
       public synchronized void addTime(int position, long time)
       {
  -        testTimes[position] = testTimes[position] + time;
  +        if(position < 1) throw new RuntimeException("Illegal position set");
  +        testTimes[position] += time;
       }
   
       public void registerPerfMain(PerfMain aPerfMain)
  
  
  

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


Mime
View raw message