You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2010/09/08 17:41:15 UTC
svn commit: r995104 - in /jackrabbit/trunk/test/performance:
base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
gnuplot.txt plot.sh
Author: jukka
Date: Wed Sep 8 15:41:14 2010
New Revision: 995104
URL: http://svn.apache.org/viewvc?rev=995104&view=rev
Log:
JCR-2695: Jackrabbit performance test suite
Improved reporting of the performance test results
Added:
jackrabbit/trunk/test/performance/plot.sh (contents, props changed)
- copied, changed from r995064, jackrabbit/trunk/test/performance/gnuplot.txt
Removed:
jackrabbit/trunk/test/performance/gnuplot.txt
Modified:
jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
Modified: jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java?rev=995104&r1=995103&r2=995104&view=diff
==============================================================================
--- jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java (original)
+++ jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java Wed Sep 8 15:41:14 2010
@@ -16,6 +16,15 @@
*/
package org.apache.jackrabbit.performance;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.regex.Pattern;
+
+import javax.jcr.SimpleCredentials;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.FileWriterWithEncoding;
@@ -23,37 +32,25 @@ import org.apache.commons.math.stat.desc
import org.apache.jackrabbit.core.RepositoryImpl;
import org.apache.jackrabbit.core.config.RepositoryConfig;
-import javax.jcr.SimpleCredentials;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
public abstract class AbstractPerformanceTest {
protected void testPerformance(String name) throws Exception {
- Set<String> tests = new HashSet<String>();
- Set<String> names = new HashSet<String>();
- String selected = System.getProperty("only");
- if (selected != null && selected.length() > 0) {
- int colon = selected.indexOf(':');
- if (colon != -1) {
- names.addAll(Arrays.asList(selected.substring(colon + 1).split(",")));
- selected = selected.substring(0, colon);
- }
- tests.addAll(Arrays.asList(selected.split(",")));
+ String only = System.getProperty("only", ".*:.*");
+ int colon = only.indexOf(':');
+ if (colon == -1) {
+ colon = only.length();
+ only = only + ":-1";
}
+ Pattern testPattern = Pattern.compile(only.substring(0, colon));
+ Pattern namePattern = Pattern.compile(only.substring(colon + 1));
+
// Create a repository using the Jackrabbit default configuration
- if (names.isEmpty() || names.contains(name)) {
+ if (namePattern.matcher(name).matches()) {
testPerformance(
name,
RepositoryImpl.class.getResourceAsStream("repository.xml"),
- tests);
+ testPattern);
}
// Create repositories for any special configurations included
@@ -66,11 +63,11 @@ public abstract class AbstractPerformanc
if (file.isFile() && xml.endsWith(".xml")) {
String repositoryName =
name + "-" + xml.substring(0, xml.length() - 4);
- if (names.isEmpty() || names.contains(repositoryName)) {
+ if (namePattern.matcher(repositoryName).matches()) {
testPerformance(
repositoryName,
FileUtils.openInputStream(file),
- tests);
+ testPattern);
}
}
}
@@ -78,53 +75,57 @@ public abstract class AbstractPerformanc
}
private void testPerformance(
- String name, InputStream xml, Set<String> tests) throws Exception {
+ String name, InputStream xml, Pattern testPattern)
+ throws Exception {
RepositoryImpl repository = createRepository(name, xml);
try {
- testPerformance(name, repository, tests);
+ testPerformance(name, repository, testPattern);
} finally {
repository.shutdown();
}
}
private void testPerformance(
- String name, RepositoryImpl repository, Set<String> tests) {
+ String name, RepositoryImpl repository, Pattern testPattern) {
PerformanceTestSuite suite = new PerformanceTestSuite(
repository,
new SimpleCredentials("admin", "admin".toCharArray()));
- runTest(suite, new LoginTest(), name, tests);
- runTest(suite, new LoginLogoutTest(), name, tests);
- runTest(suite, new SmallFileReadTest(), name, tests);
- runTest(suite, new SmallFileWriteTest(), name, tests);
- runTest(suite, new BigFileReadTest(), name, tests);
- runTest(suite, new BigFileWriteTest(), name, tests);
- runTest(suite, new ConcurrentReadTest(), name, tests);
- runTest(suite, new ConcurrentReadWriteTest(), name, tests);
- runTest(suite, new SimpleSearchTest(), name, tests);
- runTest(suite, new TwoWayJoinTest(), name, tests);
- runTest(suite, new ThreeWayJoinTest(), name, tests);
- runTest(suite, new CreateManyChildNodesTest(), name, tests);
- runTest(suite, new UpdateManyChildNodesTest(), name, tests);
- runTest(suite, new TransientManyChildNodesTest(), name, tests);
- runTest(suite, new CreateUserTest(), name, tests);
- runTest(suite, new AddGroupMembersTest(), name, tests);
- runTest(suite, new GroupMemberLookupTest(), name, tests);
- runTest(suite, new GroupGetMembersTest(), name, tests);
+ runTest(suite, new LoginTest(), name, testPattern);
+ runTest(suite, new LoginLogoutTest(), name, testPattern);
+ runTest(suite, new SmallFileReadTest(), name, testPattern);
+ runTest(suite, new SmallFileWriteTest(), name, testPattern);
+ runTest(suite, new BigFileReadTest(), name, testPattern);
+ runTest(suite, new BigFileWriteTest(), name, testPattern);
+ runTest(suite, new ConcurrentReadTest(), name, testPattern);
+ runTest(suite, new ConcurrentReadWriteTest(), name, testPattern);
+ runTest(suite, new SimpleSearchTest(), name, testPattern);
+ runTest(suite, new TwoWayJoinTest(), name, testPattern);
+ runTest(suite, new ThreeWayJoinTest(), name, testPattern);
+ runTest(suite, new CreateManyChildNodesTest(), name, testPattern);
+ runTest(suite, new UpdateManyChildNodesTest(), name, testPattern);
+ runTest(suite, new TransientManyChildNodesTest(), name, testPattern);
+ runTest(suite, new CreateUserTest(), name, testPattern);
+ try {
+ runTest(suite, new AddGroupMembersTest(), name, testPattern);
+ runTest(suite, new GroupMemberLookupTest(), name, testPattern);
+ runTest(suite, new GroupGetMembersTest(), name, testPattern);
+ } catch (NoClassDefFoundError e) {
+ // ignore these tests if the required jackrabbit-api
+ // extensions are not available
+ }
}
private void runTest(
PerformanceTestSuite suite, AbstractTest test, String name,
- Set<String> tests) {
- if (!tests.isEmpty() && !tests.contains(test.toString())) {
+ Pattern testPattern) {
+ if (!testPattern.matcher(test.toString()).matches()) {
return;
}
try {
DescriptiveStatistics statistics = suite.runTest(test);
- File base = new File("..", "base");
- File target = new File(base, "target");
- File report = new File(target, test + ".txt");
+ File report = new File("target", test + ".txt");
boolean needsPrefix = !report.exists();
PrintWriter writer = new PrintWriter(
Copied: jackrabbit/trunk/test/performance/plot.sh (from r995064, jackrabbit/trunk/test/performance/gnuplot.txt)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/test/performance/plot.sh?p2=jackrabbit/trunk/test/performance/plot.sh&p1=jackrabbit/trunk/test/performance/gnuplot.txt&r1=995064&r2=995104&rev=995104&view=diff
==============================================================================
--- jackrabbit/trunk/test/performance/gnuplot.txt (original)
+++ jackrabbit/trunk/test/performance/plot.sh Wed Sep 8 15:41:14 2010
@@ -1,3 +1,4 @@
+#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
@@ -17,32 +18,43 @@
# produced by the Jackrabbit performance test suite. Before you run this
# script you need to preprocess the individual performance reports.
+cat <<HTML >target/report.html
+<html>
+ <head>
+ <title>Jackrabbit performance</title>
+ </head>
+ <body>
+ <h1>Jackrabbit performance</h1>
+ <p>
+HTML
+
+for dat in */target/*.txt; do
+ cat "$dat" >>target/`basename "$dat"`
+done
+
+for dat in target/*.txt; do
+ name=`basename "$dat" .txt`
+ gnuplot <<PLOT
set term svg
set xlabel "Jackrabbit version"
set xrange [-1:10]
set ylabel "Time (ms)"
set yrange [0:]
+set output "target/$name.svg"
+set title "$name"
+plot "$dat" using 0:3:4:xtic(1) with errorlines notitle
+PLOT
+ convert "target/$name.svg" "target/$name.png"
+ cat <<HTML >>target/report.html
+ <img src="$name.png" alt="$name">
+HTML
+done
+
+cat <<HTML >>target/report.html
+ </p>
+ </body>
+</html>
+HTML
+
+echo file://`pwd`/target/report.html
-set output "login.svg"
-set title "1000 x login()"
-plot "login.dat" using 0:3:4:xtic(1) with errorlines notitle
-
-set output "logout.svg"
-set title "1000 x login().logout()"
-plot "logout.dat" using 0:3:4:xtic(1) with errorlines notitle
-
-set output "smallread.svg"
-set title "1000 x read a 10kB file"
-plot "smallread.dat" using 0:3:4:xtic(1) with errorlines notitle
-
-set output "smallwrite.svg"
-set title "100 x write a 10kB file"
-plot "smallwrite.dat" using 0:3:4:xtic(1) with errorlines notitle
-
-set output "bigread.svg"
-set title "read a 100MB file"
-plot "bigread.dat" using 0:3:4:xtic(1) with errorlines notitle
-
-set output "bigwrite.svg"
-set title "write a 100MB file"
-plot "bigwrite.dat" using 0:3:4:xtic(1) with errorlines notitle
Propchange: jackrabbit/trunk/test/performance/plot.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/test/performance/plot.sh
------------------------------------------------------------------------------
svn:executable = *