User: d_jencks
  Date: 01/09/19 12:16:54

  Modified:    src/main/org/jboss/test/bank/test BankStressTestCase.java
  Log:
  Changed stress tests to have counts set from build.xml.  You may set values in a 
local.properties file.
  
  Revision  Changes    Path
  1.4       +20 -20    
jbosstest/src/main/org/jboss/test/bank/test/BankStressTestCase.java
  
  Index: BankStressTestCase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/bank/test/BankStressTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BankStressTestCase.java   2001/09/18 22:00:43     1.3
  +++ BankStressTestCase.java   2001/09/19 19:16:54     1.4
  @@ -23,7 +23,7 @@
    *      
    *   @see <related>
    *   @author Author: d_jencks among many others
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
   public class BankStressTestCase
      extends JBossTestCase
  @@ -36,8 +36,6 @@
      Exception exc;
      
      // Static --------------------------------------------------------
  -   private static final int THREAD_COUNT = 10;
  -   private static final int ITERATIONS = 100;
        
      // Constructors --------------------------------------------------
        public BankStressTestCase(String name)
  @@ -170,11 +168,12 @@
         final Object lock = new Object();
      
        
  -      iter = THREAD_COUNT;
  -      getLog().info("Start test. "+THREAD_COUNT+ " threads, "+ITERATIONS+" 
iterations");
  +      iter = getThreadCount();
  +      final int iterationCount = getIterationCount();
  +      getLog().info("Start test. "+getThreadCount()+ " threads, 
"+getIterationCount()+" iterations");
         long start = System.currentTimeMillis();
   
  -      for (int i = 0; i < THREAD_COUNT; i++)
  +      for (int i = 0; i < getThreadCount(); i++)
         {
            Thread.sleep(50);
            new Thread(new Runnable()
  @@ -186,7 +185,7 @@
                  try
                  {
                     
  -                  for (int j = 0; j < ITERATIONS; j++)
  +                  for (int j = 0; j < iterationCount; j++)
                     {
                        if (exc != null) break;
                        
  @@ -226,7 +225,7 @@
         getLog().info(from.getPrimaryKey()+":"+from.getBalance());
         getLog().info(to.getPrimaryKey()+":"+to.getBalance());
         getLog().info("Time:"+(end-start));
  -      getLog().info("Avg. 
time/call(ms):"+((end-start)/(THREAD_COUNT*ITERATIONS*6)));
  +      getLog().info("Avg. 
time/call(ms):"+((end-start)/(getThreadCount()*getIterationCount()*6)));
      }
   
      public void testMultiThread2()
  @@ -243,11 +242,12 @@
         final Object lock = new Object();
      
         
  -      iter = THREAD_COUNT;
  -      getLog().info("Start test. "+THREAD_COUNT+ " threads, "+ITERATIONS+" 
iterations");
  +      iter = getThreadCount();
  +      final int iterationCount = getIterationCount();
  +      getLog().info("Start test. "+getThreadCount()+ " threads, 
"+getIterationCount()+" iterations");
         long start = System.currentTimeMillis();
   
  -      for (int i = 0; i < THREAD_COUNT; i++)
  +      for (int i = 0; i < getThreadCount(); i++)
         {
            Thread.sleep(500); // Wait between each client
            new Thread(new Runnable()
  @@ -262,7 +262,7 @@
                     Account from = teller.createAccount(marc, 50);
                     Account to = teller.createAccount(rickard, 0);
                     
  -                  for (int j = 0; j < ITERATIONS; j++)
  +                  for (int j = 0; j < iterationCount; j++)
                     {
                        if (exc != null) break;
                        
  @@ -299,7 +299,7 @@
         long end = System.currentTimeMillis();
         
         getLog().info("Time:"+(end-start));
  -      getLog().info("Avg. 
time/call(ms):"+((end-start)/(THREAD_COUNT*ITERATIONS*6)));
  +      getLog().info("Avg. 
time/call(ms):"+((end-start)/(getThreadCount()*getIterationCount()*6)));
      }
      
      public void testTransaction()
  @@ -348,7 +348,7 @@
         getLog().debug("Rickard acquired");
         
         getLog().debug("Acquire accounts");
  -      Account from = teller.getAccount(marc, 50*ITERATIONS);
  +      Account from = teller.getAccount(marc, 50*getIterationCount());
         Account to = teller.getAccount(rickard, 0);
         
         getLog().debug("Show balance");
  @@ -357,11 +357,11 @@
   
         getLog().info("Transfer money");
         long start = System.currentTimeMillis();
  -      teller.transferTest(from, to, 50, ITERATIONS);
  +      teller.transferTest(from, to, 50, getIterationCount());
         long end = System.currentTimeMillis();
         getLog().info("Transfer done");
         getLog().info("Total time(ms):"+(end-start));
  -      getLog().info("Avg. time/call(ms):"+((end-start)/(ITERATIONS*2)));
  +      getLog().info("Avg. time/call(ms):"+((end-start)/(getIterationCount()*2)));
         
         getLog().debug("Show balance");
         getLog().debug(from.getPrimaryKey()+":"+from.getBalance());
  @@ -384,12 +384,12 @@
         getLog().debug("Rickard acquired");
         
         getLog().debug("Acquire accounts");
  -      Account from = teller.getAccount(marc, 50*ITERATIONS);
  +      Account from = teller.getAccount(marc, 50*getIterationCount());
         Account to = teller.getAccount(rickard, 0);
         
         getLog().info("Do read calls");
         long start = System.currentTimeMillis();
  -      for (int i = 0; i < ITERATIONS; i++)
  +      for (int i = 0; i < getIterationCount(); i++)
         {
            marc.getName();
            from.getBalance();
  @@ -400,7 +400,7 @@
         
         getLog().info("Calls done");
         getLog().info("Total time(ms):"+(end-start));
  -      getLog().info("Avg. time/call(ms):"+((end-start)/(ITERATIONS*4)));
  +      getLog().info("Avg. time/call(ms):"+((end-start)/(getIterationCount()*4)));
         
         teller.remove();
      }
  @@ -414,7 +414,7 @@
         
         getLog().info("Create customers");
         
  -      for (int i = 0; i < ITERATIONS; i++)
  +      for (int i = 0; i < getIterationCount(); i++)
            home.create(i+"", "Smith_"+i);
         getLog().debug("Customers created");
         
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to