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

  Modified:    src/main/org/jboss/test/hello/test
                        HelloTimingStressTestCase.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.5       +38 -38    
jbosstest/src/main/org/jboss/test/hello/test/HelloTimingStressTestCase.java
  
  Index: HelloTimingStressTestCase.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/hello/test/HelloTimingStressTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HelloTimingStressTestCase.java    2001/09/18 22:00:43     1.4
  +++ HelloTimingStressTestCase.java    2001/09/19 19:16:54     1.5
  @@ -26,13 +26,13 @@
    *      
    *   @see <related>
    *   @author Author: schaefera 
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
   public class HelloTimingStressTestCase
      extends JBossTestCase
   {
      // Constants -----------------------------------------------------
  -    private static final int ITERATIONS = 500;
  +
      // Attributes ----------------------------------------------------
      
      // Static --------------------------------------------------------
  @@ -85,23 +85,23 @@
         throws Exception
      {
         long start = System.currentTimeMillis();
  -             long start2 = start;
  +      long start2 = start;
         HelloHome home = (HelloHome)getInitialContext().lookup(HelloHome.JNDI_NAME);
         Hello hello = home.create();
  -      for (int i = 0 ; i < ITERATIONS; i++)
  +      for (int i = 0 ; i < getIterationCount(); i++)
         {
  -           hello.hello("Rickard");
  +      hello.hello("Rickard");
                        
  -                     if (i % 100 == 0 && i != 0)
  -                     {
  -                             long end = System.currentTimeMillis();
  -                             getLog().debug("Time/call(ms):"+((end-start2)/100));
  -                             start2 = end;
  -                     }
  +      if (i % 100 == 0 && i != 0)
  +         {
  +            long end = System.currentTimeMillis();
  +            getLog().debug("Time/call(ms):"+((end-start2)/100));
  +            start2 = end;
  +         }
                        
         }
         long end = System.currentTimeMillis();
  -      getLog().debug("Avg. time/call(ms):"+((end-start)/ITERATIONS));
  +      getLog().debug("Avg. time/call(ms):"+((end-start)/getIterationCount()));
      }
      
      /**
  @@ -116,19 +116,19 @@
        long start2 = start;
         HelloHome home = (HelloHome)getInitialContext().lookup(HelloHome.JNDI_NAME);
         Hello hello = home.create();
  -      for (int i = 0 ; i < ITERATIONS; i++)
  +      for (int i = 0 ; i < getIterationCount(); i++)
         {
            hello.helloHello(hello);
                
  -             if (i % 100 == 0 && i != 0)
  -             {
  -                     long end = System.currentTimeMillis();
  -                     getLog().debug("Time/call(ms):"+((end-start2)/100));
  -                     start2 = end;
  -             }
  +         if (i % 100 == 0 && i != 0)
  +         {
  +            long end = System.currentTimeMillis();
  +            getLog().debug("Time/call(ms):"+((end-start2)/100));
  +            start2 = end;
  +         }
         }
         long end = System.currentTimeMillis();
  -      getLog().debug("Avg. time/call(ms):"+((end-start)/ITERATIONS));
  +      getLog().debug("Avg. time/call(ms):"+((end-start)/getIterationCount()));
      }
        
      /**
  @@ -143,28 +143,28 @@
         Hello hello = home.create();
         
         long start = System.currentTimeMillis();
  -      hello.testSpeed("Rickard", ITERATIONS);
  +      hello.testSpeed("Rickard", getIterationCount());
         long end = System.currentTimeMillis();
  -      getLog().debug("Avg. time/call(ms):"+((end-start)/ITERATIONS));
  +      getLog().debug("Avg. time/call(ms):"+((end-start)/getIterationCount()));
      }
   */   
      /**
       *   This tests the speed of InitialContext lookups
  -    *
  +    * including getting the initial context.
       * @exception   Exception  
       */
      public void testContextSpeed()
         throws Exception
      {
  -             long start = System.currentTimeMillis();
  +      long start = System.currentTimeMillis();
                
  -             getLog().debug("Starting context lookup speed test");
  -             for (int i = 0; i < ITERATIONS; i++)
  -             {
  -        HelloHome home = (HelloHome)getInitialContext().lookup(HelloHome.JNDI_NAME);
  -        }
  +      getLog().debug("Starting context lookup speed test");
  +      for (int i = 0; i < getIterationCount(); i++)
  +      {
  +         HelloHome home = (HelloHome)new 
InitialContext().lookup(HelloHome.JNDI_NAME);
  +      }
         long end = System.currentTimeMillis();
  -      getLog().debug("Avg. time/call(ms):"+((end-start)/ITERATIONS));
  +      getLog().debug("Avg. time/call(ms):"+((end-start)/getIterationCount()));
      }
        
      /**
  @@ -175,16 +175,16 @@
      public void testReusedContextSpeed()
         throws Exception
      {
  -             Context ctx = getInitialContext();
  -             long start = System.currentTimeMillis();
  +      Context ctx = getInitialContext();
  +      long start = System.currentTimeMillis();
                
  -             getLog().debug("Starting context lookup speed test");
  -             for (int i = 0; i < ITERATIONS; i++)
  -             {
  -             HelloHome home = (HelloHome)ctx.lookup(HelloHome.JNDI_NAME);
  -        }
  +      getLog().debug("Starting context lookup speed test");
  +      for (int i = 0; i < getIterationCount(); i++)
  +      {
  +         HelloHome home = (HelloHome)ctx.lookup(HelloHome.JNDI_NAME);
  +      }
         long end = System.currentTimeMillis();
  -      getLog().debug("Avg. time/call(ms):"+((end-start)/ITERATIONS));
  +      getLog().debug("Avg. time/call(ms):"+((end-start)/getIterationCount()));
      }
        
   
  
  
  

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

Reply via email to