You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/04/06 11:34:13 UTC
[46/50] tinkerpop git commit: Merge branch 'tp32'
Merge branch 'tp32'
Conflicts:
gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7d8a3693
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7d8a3693
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7d8a3693
Branch: refs/heads/TINKERPOP-1443
Commit: 7d8a3693ee681e6abf61e41fb22670ffd5799ba6
Parents: d7697ab 95d3efc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 4 16:30:10 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 4 16:30:10 2017 -0400
----------------------------------------------------------------------
gremlin-tools/gremlin-benchmark/pom.xml | 4 ++++
.../tinkerpop/benchmark/util/AbstractBenchmarkBase.java | 11 ++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7d8a3693/gremlin-tools/gremlin-benchmark/pom.xml
----------------------------------------------------------------------
diff --cc gremlin-tools/gremlin-benchmark/pom.xml
index aac2fa2,0000000..142a662
mode 100644,000000..100644
--- a/gremlin-tools/gremlin-benchmark/pom.xml
+++ b/gremlin-tools/gremlin-benchmark/pom.xml
@@@ -1,134 -1,0 +1,138 @@@
+<!--
+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.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gremlin-tools</artifactId>
+ <groupId>org.apache.tinkerpop</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gremlin-benchmark</artifactId>
+ <name>Apache TinkerPop :: Gremlin Benchmark</name>
+ <properties>
+ <jmh.version>1.11.3</jmh.version>
+ <!-- Skip benchmarks by default because they are time consuming. -->
+ <skipBenchmarks>true</skipBenchmarks>
+ <skipTests>${skipBenchmarks}</skipTests>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>gremlin-test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>tinkergraph-gremlin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-core</artifactId>
+ <version>${jmh.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openjdk.jmh</groupId>
+ <artifactId>jmh-generator-annprocess</artifactId>
+ <version>${jmh.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
+ <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
+ <includes>
+ <include>**/*Benchmark*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*$*.class</exclude>
+ <exclude>**/Abstract*</exclude>
+ <exclude>**/*_jmhType*</exclude>
+ </excludes>
+ <systemPropertyVariables>
+ <benchmarkReportDir>${project.build.directory}/reports/benchmark/</benchmarkReportDir>
++ <jvmArgs>-server -Xms2g -Xmx2g</jvmArgs>
++ <warmupIterations>10</warmupIterations>
++ <measureIterations>10</measureIterations>
++ <forks>2</forks>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <createDependencyReducedPom>false</createDependencyReducedPom>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>org.openjdk.jmh.Main</mainClass>
+ </transformer>
+ </transformers>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7d8a3693/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
----------------------------------------------------------------------
diff --cc gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
index e7ac8a4,0000000..f647f1a
mode 100644,000000..100644
--- a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
+++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
@@@ -1,117 -1,0 +1,118 @@@
+/*
+ * 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. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.benchmark.util;
+
+import org.junit.Test;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.results.format.ResultFormatType;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Base class for all TinkerPop OpenJDK JMH benchmarks. Based upon Netty's approach to running JMH benchmarks
+ * from JUnit.
+ *
+ * @see <a href="http://netty.io/wiki/microbenchmarks.html"</a>
+ *
+ * @author Ted Wilmes (http://twilmes.org)
+ */
+@Warmup(iterations = AbstractBenchmarkBase.DEFAULT_WARMUP_ITERATIONS)
+@Measurement(iterations = AbstractBenchmarkBase.DEFAULT_MEASURE_ITERATIONS)
+@Fork(AbstractBenchmarkBase.DEFAULT_FORKS)
+public abstract class AbstractBenchmarkBase {
+
+ protected static final int DEFAULT_WARMUP_ITERATIONS = 10;
+ protected static final int DEFAULT_MEASURE_ITERATIONS = 10;
+ protected static final int DEFAULT_FORKS = 2;
+ protected static final String DEFAULT_BENCHMARK_DIRECTORY = "./benchmarks/";
-
- protected static final String[] JVM_ARGS = {
- "-server", "-Xms2g", "-Xmx2g"
- };
++ protected static final String DEFAULT_JVM_ARGS = "-server -Xms2g -Xmx2g";
+
+ @Test
+ public void run() throws Exception {
+ final String className = getClass().getSimpleName();
+
+ final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
+ .include(".*" + className + ".*")
- .jvmArgs(JVM_ARGS);
++ .jvmArgs(getJvmArgs());
+
+ if (getWarmupIterations() > 0) {
+ runnerOptions.warmupIterations(getWarmupIterations());
+ }
+
+ if (getMeasureIterations() > 0) {
+ runnerOptions.measurementIterations(getMeasureIterations());
+ }
+
+ if (getForks() > 0) {
+ runnerOptions.forks(getForks());
+ }
+
+ if (getReportDir() != null) {
+ final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
+ final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
+ final File file = new File(filePath);
+ if (file.exists()) {
+ file.delete();
+ } else {
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ }
+
+ runnerOptions.resultFormat(ResultFormatType.JSON);
+ runnerOptions.result(filePath);
+ }
+
+ new Runner(runnerOptions.build()).run();
+ }
+
+ protected int getWarmupIterations() {
+ return getIntProperty("warmupIterations", DEFAULT_WARMUP_ITERATIONS);
+ }
+
+ protected int getMeasureIterations() {
+ return getIntProperty("measureIterations", DEFAULT_MEASURE_ITERATIONS);
+ }
+
+ protected int getForks() {
+ return getIntProperty("forks", DEFAULT_FORKS);
+ }
+
+ protected String getReportDir() {
+ return System.getProperty("benchmarkReportDir", DEFAULT_BENCHMARK_DIRECTORY);
+ }
+
++ protected String[] getJvmArgs() {
++ return System.getProperty("jvmArgs", DEFAULT_JVM_ARGS).split(" ");
++ }
++
+ private int getIntProperty(final String propertyName, final int defaultValue) {
+ final String propertyValue = System.getProperty(propertyName);
+ if(propertyValue == null) {
+ return defaultValue;
+ }
+ return Integer.valueOf(propertyValue);
+ }
+}