[jbosscache-commits] JBoss Cache SVN: r5036 - cache-bench-fwk/trunk/src/org/cachebench/tests.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jan 7 10:34:10 EST 2008


Author: mircea.markus
Date: 2008-01-07 10:34:10 -0500 (Mon, 07 Jan 2008)
New Revision: 5036

Modified:
   cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
Log:
added session simulator test + refactoring

Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	2008-01-07 14:18:23 UTC (rev 5035)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java	2008-01-07 15:34:10 UTC (rev 5036)
@@ -20,11 +20,13 @@
    private static final Log log = LogFactory.getLog(SessionSimulatorTest.class);
 
    public static final String SESSION_PREFIX = "SESSION_";
+   private static int LOG_AFTER_OPERATION_COUNT = 5000;
    Configuration configuration;
    private TestConfig thisTestConfig;
    private String sessionId;
    private CacheWrapper cacheWrapper;
 
+
    /**
     * total number of request to be made against this session: reads + writes
     */
@@ -75,6 +77,7 @@
       long start=System.currentTimeMillis();
       for (int i = 0; i < numberOfRequests; i++)
       {
+         logRunCount(i);
          randomAction = r.nextInt(100);
          randomAttribute = r.nextInt(numberOfAttributes - 1);
          byte[] buf;
@@ -113,6 +116,14 @@
       return result;
    }
 
+   private void logRunCount(int i)
+   {
+      if (i % LOG_AFTER_OPERATION_COUNT == 0)
+      {
+         log.info("SessionSimulatorTest performed " + i + " oprations");
+      }
+   }
+
    private void initSession() throws Exception
    {
       for (int i = 0; i < numberOfAttributes; i++)




More information about the jbosscache-commits mailing list