You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/03/16 05:20:32 UTC
[bookkeeper] branch master updated: Merge tests/jmh into
microbenchmark
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 8ae8e00 Merge tests/jmh into microbenchmark
8ae8e00 is described below
commit 8ae8e00bab15d2ec5d596547c106c9b39b8d5a40
Author: Sijie Guo <si...@apache.org>
AuthorDate: Thu Mar 15 22:20:25 2018 -0700
Merge tests/jmh into microbenchmark
Descriptions of the changes in this PR:
tests/jmh was added a while ago, but it is got dropped out of root pom with mistakes.
mircobenchmark was added later. it is making sense to merge tests/jmh into microbenchmark module since they are using jmh to do microbenchmarks
Author: Sijie Guo <si...@apache.org>
Reviewers: Enrico Olivelli <eo...@gmail.com>, Jia Zhai <None>
This closes #1265 from sijie/move_jmh_to_benchmarks
---
.../main/resources/bookkeeper/findbugsExclude.xml | 16 +++-
.../bookkeeper/proto}/ProtocolBenchmark.java | 25 +++---
.../checksum => stats}/StatsLoggerBenchmark.java | 19 ++--
tests/jmh/pom.xml | 100 ---------------------
4 files changed, 33 insertions(+), 127 deletions(-)
diff --git a/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml b/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
index aea95d4..1886c2a 100644
--- a/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
+++ b/buildtools/src/main/resources/bookkeeper/findbugsExclude.xml
@@ -33,9 +33,6 @@
<Class name="~org\.apache\.bookkeeper\.proto\.DataFormats.*" />
</Match>
<Match>
- <Class name="~org\.apache\.bookkeeper\.proto\.checksum\.generated.*" />
- </Match>
- <Match>
<!-- generated code, we can't be held responsible for findbugs in it //-->
<Class name="~org\.apache\.bookkeeper\.proto\.BookkeeperProtocol.*" />
</Match>
@@ -114,6 +111,19 @@
<Class name="org.apache.bookkeeper.client.BKException$Code" />
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
</And>
+
+ <!-- microbenchmarks -->
+ <!-- jmh generated code -->
+ <Match>
+ <Class name="~org\.apache\.bookkeeper\.proto\.generated.*" />
+ </Match>
+ <Match>
+ <Class name="~org\.apache\.bookkeeper\.proto\.checksum\.generated.*" />
+ </Match>
+ <Match>
+ <Class name="~org\.apache\.bookkeeper\.stats\.generated.*" />
+ </Match>
+
<!-- modules under stream/ -->
<!-- common -->
diff --git a/tests/jmh/src/main/java/org/apache/bookkeeper/tests/ProtocolBenchmark.java b/microbenchmarks/src/main/java/org/apache/bookkeeper/proto/ProtocolBenchmark.java
similarity index 86%
rename from tests/jmh/src/main/java/org/apache/bookkeeper/tests/ProtocolBenchmark.java
rename to microbenchmarks/src/main/java/org/apache/bookkeeper/proto/ProtocolBenchmark.java
index c87549f..ce1f02b 100644
--- a/tests/jmh/src/main/java/org/apache/bookkeeper/tests/ProtocolBenchmark.java
+++ b/microbenchmarks/src/main/java/org/apache/bookkeeper/proto/ProtocolBenchmark.java
@@ -1,5 +1,4 @@
/*
- *
* 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
@@ -8,17 +7,15 @@
* "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.
+ * 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.bookkeeper.tests;
+package org.apache.bookkeeper.proto;
import static com.google.common.base.Charsets.UTF_8;
@@ -32,12 +29,12 @@ import java.util.concurrent.TimeUnit;
import org.apache.bookkeeper.proto.BookieProtoEncoding.EnDecoder;
import org.apache.bookkeeper.proto.BookieProtoEncoding.RequestEnDeCoderPreV3;
import org.apache.bookkeeper.proto.BookieProtoEncoding.RequestEnDecoderV3;
-import org.apache.bookkeeper.proto.BookieProtocol;
import org.apache.bookkeeper.proto.BookkeeperProtocol.AddRequest;
import org.apache.bookkeeper.proto.BookkeeperProtocol.BKPacketHeader;
import org.apache.bookkeeper.proto.BookkeeperProtocol.OperationType;
import org.apache.bookkeeper.proto.BookkeeperProtocol.ProtocolVersion;
import org.apache.bookkeeper.proto.BookkeeperProtocol.Request;
+import org.apache.bookkeeper.util.ByteBufList;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
@@ -85,15 +82,17 @@ public class ProtocolBenchmark {
@Benchmark
public void testAddEntryV2() throws Exception {
- BookieProtocol.AddRequest req = new BookieProtocol.AddRequest(
+ ByteBufList list = ByteBufList.get(entry.slice());
+ BookieProtocol.AddRequest req = BookieProtocol.AddRequest.create(
BookieProtocol.CURRENT_PROTOCOL_VERSION,
ledgerId,
entryId,
flags,
masterKey,
- entry.slice());
+ list);
Object res = this.reqEnDeV2.encode(req, ByteBufAllocator.DEFAULT);
ReferenceCountUtil.release(res);
+ ReferenceCountUtil.release(list);
}
@Benchmark
diff --git a/microbenchmarks/src/main/java/org/apache/bookkeeper/proto/checksum/StatsLoggerBenchmark.java b/microbenchmarks/src/main/java/org/apache/bookkeeper/stats/StatsLoggerBenchmark.java
similarity index 87%
rename from microbenchmarks/src/main/java/org/apache/bookkeeper/proto/checksum/StatsLoggerBenchmark.java
rename to microbenchmarks/src/main/java/org/apache/bookkeeper/stats/StatsLoggerBenchmark.java
index 3388933..9b5bdc0 100644
--- a/microbenchmarks/src/main/java/org/apache/bookkeeper/proto/checksum/StatsLoggerBenchmark.java
+++ b/microbenchmarks/src/main/java/org/apache/bookkeeper/stats/StatsLoggerBenchmark.java
@@ -1,5 +1,4 @@
-/**
- *
+/*
* 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
@@ -8,18 +7,16 @@
* "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.
+ * 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.bookkeeper.proto.checksum;
+package org.apache.bookkeeper.stats;
import java.util.HashMap;
import java.util.Map;
diff --git a/tests/jmh/pom.xml b/tests/jmh/pom.xml
deleted file mode 100644
index f7df3d2..0000000
--- a/tests/jmh/pom.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.bookkeeper.tests</groupId>
- <artifactId>tests-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>jmh-test</artifactId>
- <name>Apache BookKeeper :: Tests :: JMH Benchmark</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.bookkeeper</groupId>
- <artifactId>bookkeeper-server</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>
- <version>${slf4j.version}</version>
- </dependency>
- </dependencies>
-
- <properties>
- <!--
- Name of the benchmark Uber-JAR to generate.
- -->
- <uberjar.name>jmh-benchmarks</uberjar.name>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>${maven-shade-plugin.version}</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <finalName>${uberjar.name}</finalName>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <mainClass>org.openjdk.jmh.Main</mainClass>
- </transformer>
- </transformers>
- <filters>
- <filter>
- <!--
- Shading signed JARs will fail without this.
- http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
- -->
- <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>
--
To stop receiving notification emails like this one, please contact
sijie@apache.org.