[jboss-cvs] JBossCache/tests/perf/org/jboss/cache/loader ...

Galder Zamarreno galder.zamarreno at jboss.com
Fri Jan 12 12:02:03 EST 2007


  User: gzamarreno
  Date: 07/01/12 12:02:03

  Modified:    tests/perf/org/jboss/cache/loader 
                        JDBCCacheLoaderPerfTest.java
  Log:
  [JBCACHE-879] Functionality for JDBCacheLoader to use version aware marshalling mechanism instead of standard serialization has been introduced. Previous method has been commented out in case there's a need to revert back to it as profiling/performance study has not finished yet.
  
  Revision  Changes    Path
  1.12      +21 -6     JBossCache/tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JDBCCacheLoaderPerfTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/loader/JDBCCacheLoaderPerfTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- JDBCCacheLoaderPerfTest.java	11 Jan 2007 13:49:07 -0000	1.11
  +++ JDBCCacheLoaderPerfTest.java	12 Jan 2007 17:02:02 -0000	1.12
  @@ -21,17 +21,17 @@
    * Tests JDBCCacheLoader
    *
    * @author <a href="mailto:hmesha at novell.com">Hany Mesha</a>
  + * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
    */
   public class JDBCCacheLoaderPerfTest extends AbstractCacheLoaderTestBase
   {
      private CacheImpl cache;
   
  -
      private Random random = new Random();
   
      // Tune as necessary
  -   private static final int NUM_TIMES_PER_THREAD = 1;
  -   private static final int NUM_THREADS = 1;
  +   private static final int NUM_TIMES_PER_THREAD = 10;
  +   private static final int NUM_THREADS = 2;
      private static final String threadNamePrefix = "TesterThread-";
   
      private long[] putStat = new long[NUM_THREADS * NUM_TIMES_PER_THREAD];
  @@ -96,6 +96,8 @@
            {
               public void run()
               {
  +               int id = retrieveThreadId(getName());
  +               
                  try
                  {
                     Fqn base = new Fqn(new Object[]{"Threads", getName()});
  @@ -104,12 +106,13 @@
                     {
                        cache.put(base, "key" + j, "value" + j);
                        long timeTaken = System.currentTimeMillis() - start;
  -                     putStat[j] = timeTaken;
  +                     putStat[j+id] = timeTaken;
                     }
                  }
                  catch (Exception e)
                  {
                     e.printStackTrace();
  +                  fail();                  
                  }
               }
            };
  @@ -134,6 +137,8 @@
            {
               public void run()
               {
  +               int id = retrieveThreadId(getName());
  +               
                  try
                  {
                     Fqn fqn = Fqn.fromString("/Threads/" + getName());
  @@ -142,13 +147,14 @@
                     {
                        assertNotNull(cache.get(fqn, "key" + j));
                        long timeTaken = System.currentTimeMillis() - start;
  -                     getStat[j] = timeTaken;
  +                     getStat[j+id] = timeTaken;
                     }
   
                  }
                  catch (Exception e)
                  {
                     e.printStackTrace();
  +                  fail();
                  }
               }
            };
  @@ -174,6 +180,8 @@
            {
               public void run()
               {
  +               int id = retrieveThreadId(getName());
  +
                  try
                  {
                     Fqn fqn = Fqn.fromString("/Threads/" + getName());
  @@ -183,13 +191,14 @@
                        assertNotNull(cache.remove(fqn, "key" + j));
                        cache.evict(fqn);
                        long timeTaken = System.currentTimeMillis() - start;
  -                     removeStat[j] = timeTaken;
  +                     removeStat[j+id] = timeTaken;
                     }
   
                  }
                  catch (Exception e)
                  {
                     e.printStackTrace();
  +                  fail();                  
                  }
               }
            };
  @@ -272,6 +281,12 @@
         return results;
      }
   
  +   private int retrieveThreadId(String name)
  +   {
  +      int separatorIndex = name.indexOf('-');
  +      return Integer.valueOf(name.substring(separatorIndex + 1, name.length())) * NUM_TIMES_PER_THREAD;
  +   }   
  +
      public static void main(String[] args)
      {
         TestRunner.run(JDBCCacheLoaderPerfTest.class);
  
  
  



More information about the jboss-cvs-commits mailing list