db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r538253 - in /db/ojb/trunk/src/test/org/apache/ojb/performance: PerfMain.java PerfTest.java
Date Tue, 15 May 2007 16:53:14 GMT
Author: arminw
Date: Tue May 15 09:53:14 2007
New Revision: 538253

URL: http://svn.apache.org/viewvc?view=rev&rev=538253
Log:
minor changes, print more info about tests

Modified:
    db/ojb/trunk/src/test/org/apache/ojb/performance/PerfMain.java
    db/ojb/trunk/src/test/org/apache/ojb/performance/PerfTest.java

Modified: db/ojb/trunk/src/test/org/apache/ojb/performance/PerfMain.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/performance/PerfMain.java?view=diff&rev=538253&r1=538252&r2=538253
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/performance/PerfMain.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/performance/PerfMain.java Tue May 15 09:53:14 2007
@@ -109,7 +109,7 @@
     protected static final String EOL = SystemUtils.LINE_SEPARATOR;
 
     /** iterations per thread */
-    private static int iterationsPerThread = 100;
+    private static int objectNumber = 100;
     /** number of concurrent threads */
     private static int concurrentThreads = 10;
     /** if false we use performance optimized delete/insert method */
@@ -192,7 +192,7 @@
             // number of insert/fetch/delete loops per thread
             if (args.length > 3)
             {
-                iterationsPerThread = Integer.parseInt(args[3]);
+                objectNumber = Integer.parseInt(args[3]);
             }
             // run in stress mode
             if (args.length > 4)
@@ -223,8 +223,9 @@
         }
 
         if(logAll) printer().println("                                                  
 " +
-                EOL + "Start OJB Performance Test - running " + testLoops + " test loops"
+
-                EOL + "---------------------------------------------------");
+                EOL + "Start OJB Performance Test - " + testLoops + " loops, " + concurrentThreads
+                + " concurrent threads, " + objectNumber + " objects"
+                + EOL + "-----------------------------------------------------------------------");
 
         PerfRunner test;
         Runtime rt = Runtime.getRuntime();
@@ -265,6 +266,7 @@
             testList = tmpList;
         }
 
+        int counter = 0;
         // should always be skipped, because we use 'thread.join'
         while(threadGroup.activeCount() > 0)
         {
@@ -272,11 +274,18 @@
             try
             {
                 Thread.sleep(200);
+                ++counter;
             }
             catch(InterruptedException ignore)
             {
                 // ignore
             }
+            if(counter == 10)
+            {
+                PerfMain.printer().println("## active threads: " + threadGroup.activeCount()
+                        + ", seems these threads will never expire -> will ignore this
thread. This can influence futher test cycle");
+                break;
+            }
         }
     }
 
@@ -417,15 +426,15 @@
         buf.append(EOL);
         buf.append(indent).append(PerfMain.getConcurrentThreads());
         buf.append(" concurrent threads, handle ");
-        buf.append(PerfMain.getIterationsPerThread());
+        buf.append(PerfMain.getObjectNumber());
         buf.append(" objects per thread");
-        buf.append(EOL).append(indent).append(iterationsPerThread).append(" INSERT operations
per test instance");
-        buf.append(EOL).append(indent + "FETCH collection of ").append(iterationsPerThread).append("
objects per test instance");
-        buf.append(EOL).append(indent + "Repeat FETCH collection of ").append(iterationsPerThread).append("
objects per test instance");
-        int byIdCalls = (iterationsPerThread / PerfMain.BY_IDENTITY_FACTOR);
+        buf.append(EOL).append(indent).append(objectNumber).append(" INSERT operations per
test instance");
+        buf.append(EOL).append(indent + "FETCH collection of ").append(objectNumber).append("
objects per test instance");
+        buf.append(EOL).append(indent + "Repeat FETCH collection of ").append(objectNumber).append("
objects per test instance");
+        int byIdCalls = (objectNumber / PerfMain.BY_IDENTITY_FACTOR);
         buf.append(EOL).append(indent).append((byIdCalls == 0 ? 1: byIdCalls)).append(" get
by Identity calls  per test instance");
-        buf.append(EOL).append(indent).append(iterationsPerThread).append(" UPDATE operations
per test instance");
-        buf.append(EOL).append(indent).append(iterationsPerThread).append(" DELETE operations
per test instance");
+        buf.append(EOL).append(indent).append(objectNumber).append(" UPDATE operations per
test instance");
+        buf.append(EOL).append(indent).append(objectNumber).append(" DELETE operations per
test instance");
         buf.append(EOL).append(indent);
         buf.append("- ").append(!(isUseStressMode()) ? "performance mode" : "stress mode");
         buf.append(" - results per test instance (average)");
@@ -583,7 +592,7 @@
             result = new PerfResult();
             result.setTestName(testName);
             result.setStressMode(isUseStressMode());
-            result.setIterationsPerThread(getIterationsPerThread());
+            result.setIterationsPerThread(getObjectNumber());
             result.setNumberOfThreads(getConcurrentThreads());
             result.setTestLoops(getTestLoops());
             resultMap.put(testName, result);
@@ -650,9 +659,9 @@
         return resultMap.values();
     }
 
-    public static int getIterationsPerThread()
+    public static int getObjectNumber()
     {
-        return iterationsPerThread;
+        return objectNumber;
     }
 
     public static int getConcurrentThreads()

Modified: db/ojb/trunk/src/test/org/apache/ojb/performance/PerfTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/performance/PerfTest.java?view=diff&rev=538253&r1=538252&r2=538253
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/performance/PerfTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/performance/PerfTest.java Tue May 15 09:53:14 2007
@@ -172,8 +172,8 @@
      */
     public void run()
     {
-        PerfArticle[] m_arr = new PerfArticle[PerfMain.getIterationsPerThread()];
-        for (int i = 0; i < PerfMain.getIterationsPerThread(); i++)
+        PerfArticle[] m_arr = new PerfArticle[PerfMain.getObjectNumber()];
+        for (int i = 0; i < PerfMain.getObjectNumber(); i++)
         {
             m_arr[i] = getPreparedPerfArticle(getTestObjectName());
         }



---------------------------------------------------------------------
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