jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1352482 - in /jackrabbit/oak/trunk/oak-bench/base: ./ src/main/java/org/apache/jackrabbit/oak/performance/
Date Thu, 21 Jun 2012 09:58:53 GMT
Author: thomasm
Date: Thu Jun 21 09:58:52 2012
New Revision: 1352482

URL: http://svn.apache.org/viewvc?rev=1352482&view=rev
Log:
OAK-122 Formatting (spaces instead of tabs, reduce warnings, svn .ignore)

Modified:
    jackrabbit/oak/trunk/oak-bench/base/   (props changed)
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java

Propchange: jackrabbit/oak/trunk/oak-bench/base/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jun 21 09:58:52 2012
@@ -0,0 +1,4 @@
+target
+.settings
+.classpath
+.project

Modified: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java?rev=1352482&r1=1352481&r2=1352482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
(original)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
Thu Jun 21 09:58:52 2012
@@ -32,114 +32,114 @@ import org.apache.jackrabbit.oak.jcr.Rep
 
 public abstract class AbstractPerformanceTest {
 
-	private final int warmup = 1;
+    private final int warmup = 1;
 
-	private final int runtime = 10;
+    private final int runtime = 10;
 
-	private final Credentials credentials = new SimpleCredentials("admin",
-			"admin".toCharArray());
+    private final Credentials credentials = new SimpleCredentials("admin",
+            "admin".toCharArray());
 
-	private final Pattern microKernelPattern = Pattern.compile(System
-			.getProperty("mk", ".*"));
-	private final Pattern testPattern = Pattern.compile(System.getProperty(
-			"only", ".*"));
-
-	protected void testPerformance(String name, String microKernel)
-			throws Exception {
-
-		runTest(new LoginTest(), name, microKernel);
-		runTest(new LoginLogoutTest(), name, microKernel);
-		runTest(new ReadPropertyTest(), name, microKernel);
-		runTest(new SetPropertyTest(), name, microKernel);
-		runTest(new SmallFileReadTest(), name, microKernel);
-		runTest(new SmallFileWriteTest(), name, microKernel);
-		runTest(new ConcurrentReadTest(), name, microKernel);
+    private final Pattern microKernelPattern = Pattern.compile(System
+            .getProperty("mk", ".*"));
+    private final Pattern testPattern = Pattern.compile(System.getProperty(
+            "only", ".*"));
+
+    protected void testPerformance(String name, String microKernel)
+            throws Exception {
+
+        runTest(new LoginTest(), name, microKernel);
+        runTest(new LoginLogoutTest(), name, microKernel);
+        runTest(new ReadPropertyTest(), name, microKernel);
+        runTest(new SetPropertyTest(), name, microKernel);
+        runTest(new SmallFileReadTest(), name, microKernel);
+        runTest(new SmallFileWriteTest(), name, microKernel);
+        runTest(new ConcurrentReadTest(), name, microKernel);
         runTest(new ConcurrentReadWriteTest(), name, microKernel);
-		runTest(new SimpleSearchTest(), name, microKernel);
-		runTest(new SQL2SearchTest(), name, microKernel);
-		runTest(new DescendantSearchTest(), name, microKernel);
-		runTest(new SQL2DescendantSearchTest(), name, microKernel);
-		runTest(new CreateManyChildNodesTest(), name, microKernel);
-		runTest(new UpdateManyChildNodesTest(), name, microKernel);
-		runTest(new TransientManyChildNodesTest(), name, microKernel);
-
-	}
-
-	private void runTest(AbstractTest test, String name, String microKernel) {
-		if (microKernelPattern.matcher(microKernel).matches()
-				&& testPattern.matcher(test.toString()).matches()) {
-
-			RepositoryImpl repository;
-			try {
-				repository = createRepository(microKernel);
-
-				// Run the test
-				DescriptiveStatistics statistics = runTest(test, repository);
-				if (statistics.getN() > 0) {
-					writeReport(test.toString(), name, microKernel, statistics);
-				}
-			} catch (RepositoryException re) {
-				re.printStackTrace();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-	}
-
-	private DescriptiveStatistics runTest(AbstractTest test,
-			Repository repository) throws Exception {
-		DescriptiveStatistics statistics = new DescriptiveStatistics();
-
-		test.setUp(repository, credentials);
-		try {
-			// Run a few iterations to warm up the system
-			long warmupEnd = System.currentTimeMillis() + warmup * 1000;
-			while (System.currentTimeMillis() < warmupEnd) {
-				test.execute();
-			}
-
-			// Run test iterations, and capture the execution times
-			long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
-			while (System.currentTimeMillis() < runtimeEnd) {
-				statistics.addValue(test.execute());
-			}
-		} finally {
-			test.tearDown();
-		}
+        runTest(new SimpleSearchTest(), name, microKernel);
+        runTest(new SQL2SearchTest(), name, microKernel);
+        runTest(new DescendantSearchTest(), name, microKernel);
+        runTest(new SQL2DescendantSearchTest(), name, microKernel);
+        runTest(new CreateManyChildNodesTest(), name, microKernel);
+        runTest(new UpdateManyChildNodesTest(), name, microKernel);
+        runTest(new TransientManyChildNodesTest(), name, microKernel);
+
+    }
+
+    private void runTest(AbstractTest test, String name, String microKernel) {
+        if (microKernelPattern.matcher(microKernel).matches()
+                && testPattern.matcher(test.toString()).matches()) {
+
+            RepositoryImpl repository;
+            try {
+                repository = createRepository(microKernel);
+
+                // Run the test
+                DescriptiveStatistics statistics = runTest(test, repository);
+                if (statistics.getN() > 0) {
+                    writeReport(test.toString(), name, microKernel, statistics);
+                }
+            } catch (RepositoryException re) {
+                re.printStackTrace();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private DescriptiveStatistics runTest(AbstractTest test,
+            Repository repository) throws Exception {
+        DescriptiveStatistics statistics = new DescriptiveStatistics();
+
+        test.setUp(repository, credentials);
+        try {
+            // Run a few iterations to warm up the system
+            long warmupEnd = System.currentTimeMillis() + warmup * 1000;
+            while (System.currentTimeMillis() < warmupEnd) {
+                test.execute();
+            }
+
+            // Run test iterations, and capture the execution times
+            long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+            while (System.currentTimeMillis() < runtimeEnd) {
+                statistics.addValue(test.execute());
+            }
+        } finally {
+            test.tearDown();
+        }
 
-		return statistics;
-	}
+        return statistics;
+    }
 
-	private static void writeReport(String test, String name, String microKernel,
+    private static void writeReport(String test, String name, String microKernel,
             DescriptiveStatistics statistics) throws IOException {
-		File report = new File("target", test + "-" + microKernel + ".txt");
+        File report = new File("target", test + "-" + microKernel + ".txt");
 
-		boolean needsPrefix = !report.exists();
-		PrintWriter writer = new PrintWriter(new FileWriterWithEncoding(report,
-				"UTF-8", true));
-		try {
-			if (needsPrefix) {
-				writer.format(
-						"# %-34.34s     min     10%%     50%%     90%%     max%n",
-						test);
-			}
-
-			writer.format("%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
-					name, statistics.getMin(), statistics.getPercentile(10.0),
-					statistics.getPercentile(50.0),
-					statistics.getPercentile(90.0), statistics.getMax());
-		} finally {
-			writer.close();
-		}
-	}
+        boolean needsPrefix = !report.exists();
+        PrintWriter writer = new PrintWriter(new FileWriterWithEncoding(report,
+                "UTF-8", true));
+        try {
+            if (needsPrefix) {
+                writer.format(
+                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
+                        test);
+            }
+
+            writer.format("%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+                    name, statistics.getMin(), statistics.getPercentile(10.0),
+                    statistics.getPercentile(50.0),
+                    statistics.getPercentile(90.0), statistics.getMax());
+        } finally {
+            writer.close();
+        }
+    }
 
-	protected RepositoryImpl createRepository(String microKernel)
-			throws RepositoryException {
+    protected RepositoryImpl createRepository(String microKernel)
+            throws RepositoryException {
 
-		// TODO: depending on the microKernel string a particular repository
-		// with that MK must be returned
+        // TODO: depending on the microKernel string a particular repository
+        // with that MK must be returned
 
-		return new RepositoryImpl();
-	}
+        return new RepositoryImpl();
+    }
 
 }

Modified: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java?rev=1352482&r1=1352481&r2=1352482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
(original)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
Thu Jun 21 09:58:52 2012
@@ -29,71 +29,71 @@ import javax.jcr.SimpleCredentials;
  */
 public class ConcurrentReadTest extends AbstractTest {
 
-	protected static final int NODE_COUNT = 100;
+    protected static final int NODE_COUNT = 100;
 
-	private static final int READER_COUNT = getScale(20);
+    private static final int READER_COUNT = getScale(20);
 
-	private Session session;
+    private Session session;
 
-	protected Node root;
+    protected Node root;
 
-	@Override
+    @Override
     public void beforeSuite() throws Exception {
-		session = getRepository().login(
-				new SimpleCredentials("admin", "admin".toCharArray()));
-		root = session.getRootNode().addNode("testroot", "nt:unstructured");
-		for (int i = 0; i < NODE_COUNT; i++) {
-			Node node = root.addNode("node" + i, "nt:unstructured");
-			for (int j = 0; j < NODE_COUNT; j++) {
-				node.addNode("node" + j, "nt:unstructured");
-			}
-			session.save();
-		}
-
-		for (int i = 0; i < READER_COUNT; i++) {
-			addBackgroundJob(new Reader());
-		}
-	}
-
-	private class Reader implements Runnable {
-
-		private Session session;
-
-		private final Random random = new Random();
-
-		public void run() {
-
-			try {
-				session = getRepository().login(
-						new SimpleCredentials("admin", "admin".toCharArray()));
-				int i = random.nextInt(NODE_COUNT);
-				int j = random.nextInt(NODE_COUNT);
-				session.getRootNode()
-						.getNode("testroot/node" + i + "/node" + j);
-			} catch (RepositoryException e) {
-				throw new RuntimeException(e);
-			}
-		}
+        session = getRepository().login(
+                new SimpleCredentials("admin", "admin".toCharArray()));
+        root = session.getRootNode().addNode("testroot", "nt:unstructured");
+        for (int i = 0; i < NODE_COUNT; i++) {
+            Node node = root.addNode("node" + i, "nt:unstructured");
+            for (int j = 0; j < NODE_COUNT; j++) {
+                node.addNode("node" + j, "nt:unstructured");
+            }
+            session.save();
+        }
+
+        for (int i = 0; i < READER_COUNT; i++) {
+            addBackgroundJob(new Reader());
+        }
+    }
+
+    class Reader implements Runnable {
+
+        private Session session;
+
+        private final Random random = new Random();
+
+        public void run() {
+
+            try {
+                session = getRepository().login(
+                        new SimpleCredentials("admin", "admin".toCharArray()));
+                int i = random.nextInt(NODE_COUNT);
+                int j = random.nextInt(NODE_COUNT);
+                session.getRootNode()
+                        .getNode("testroot/node" + i + "/node" + j);
+            } catch (RepositoryException e) {
+                throw new RuntimeException(e);
+            }
+        }
 
-	}
+    }
 
-	@Override
+    @Override
     public void runTest() throws Exception {
-		Reader reader = new Reader();
-		for (int i = 0; i < 1000; i++) {
-			reader.run();
-		}
-	}
+        Reader reader = new Reader();
+        for (int i = 0; i < 1000; i++) {
+            reader.run();
+        }
+    }
 
-	@Override
+    @Override
     public void afterSuite() throws Exception {
-		for (int i = 0; i < NODE_COUNT; i++) {
-			root.getNode("node" + i).remove();
-			session.save();
-		}
-
-		root.remove();
-		session.save();
-	}
+        for (int i = 0; i < NODE_COUNT; i++) {
+            root.getNode("node" + i).remove();
+            session.save();
+        }
+
+        root.remove();
+        session.save();
+    }
 
 }

Modified: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java?rev=1352482&r1=1352481&r2=1352482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
(original)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
Thu Jun 21 09:58:52 2012
@@ -36,7 +36,7 @@ public class ConcurrentReadWriteTest ext
         addBackgroundJob(new Writer());
     }
 
-    private class Writer implements Runnable {
+    class Writer implements Runnable {
 
         private Session session;
 
@@ -46,8 +46,8 @@ public class ConcurrentReadWriteTest ext
 
         public void run() {
             try {
-            	session = getRepository().login(
-        				new SimpleCredentials("admin", "admin".toCharArray()));
+                session = getRepository().login(
+                        new SimpleCredentials("admin", "admin".toCharArray()));
                 int i = random.nextInt(NODE_COUNT);
                 int j = random.nextInt(NODE_COUNT);
                 Node node = session.getRootNode().getNode(

Modified: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java?rev=1352482&r1=1352481&r2=1352482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
(original)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
Thu Jun 21 09:58:52 2012
@@ -24,13 +24,13 @@ import javax.jcr.SimpleCredentials;
 
 public class LoginLogoutTest extends AbstractTest {
 
-	@Override
-	public void setUp(Repository repository, Credentials credentials)
-			throws Exception {
-		super.setUp(repository,
-				new SimpleCredentials("admin", "admin".toCharArray()));
-	}
-	
+    @Override
+    public void setUp(Repository repository, Credentials credentials)
+            throws Exception {
+        super.setUp(repository,
+                new SimpleCredentials("admin", "admin".toCharArray()));
+    }
+    
     @Override
     public void runTest() throws RepositoryException {
         Repository repository = getRepository();

Modified: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java?rev=1352482&r1=1352481&r2=1352482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java
(original)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java
Thu Jun 21 09:58:52 2012
@@ -24,28 +24,28 @@ import javax.jcr.SimpleCredentials;
 
 public class LoginTest extends AbstractTest {
 
-	private final Session[] sessions = new Session[1000];
+    private final Session[] sessions = new Session[1000];
 
-	@Override
-	public void setUp(Repository repository, Credentials credentials)
-			throws Exception {
-		super.setUp(repository,
-				new SimpleCredentials("admin", "admin".toCharArray()));
-	}
+    @Override
+    public void setUp(Repository repository, Credentials credentials)
+            throws Exception {
+        super.setUp(repository,
+                new SimpleCredentials("admin", "admin".toCharArray()));
+    }
 
-	@Override
+    @Override
     public void runTest() throws RepositoryException {
-		for (int i = 0; i < sessions.length; i++) {
-			sessions[i] = getRepository().login(getCredentials(), "default");
-		}
+        for (int i = 0; i < sessions.length; i++) {
+            sessions[i] = getRepository().login(getCredentials(), "default");
+        }
 
-	}
+    }
 
-	@Override
+    @Override
     public void afterTest() throws RepositoryException {
         for (Session session : sessions) {
             session.logout();
         }
-	}
+    }
 
 }



Mime
View raw message