diff --git a/buffer/src/main/java/io/netty/buffer/b2/Allocator.java b/src/main/java/io/netty/buffer/b2/Allocator.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Allocator.java rename to src/main/java/io/netty/buffer/b2/Allocator.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/AllocatorControl.java b/src/main/java/io/netty/buffer/b2/AllocatorControl.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/AllocatorControl.java rename to src/main/java/io/netty/buffer/b2/AllocatorControl.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Buf.java b/src/main/java/io/netty/buffer/b2/Buf.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Buf.java rename to src/main/java/io/netty/buffer/b2/Buf.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/BufAccessors.java b/src/main/java/io/netty/buffer/b2/BufAccessors.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/BufAccessors.java rename to src/main/java/io/netty/buffer/b2/BufAccessors.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/ByteIterator.java b/src/main/java/io/netty/buffer/b2/ByteIterator.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/ByteIterator.java rename to src/main/java/io/netty/buffer/b2/ByteIterator.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/CompositeBuf.java b/src/main/java/io/netty/buffer/b2/CompositeBuf.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/CompositeBuf.java rename to src/main/java/io/netty/buffer/b2/CompositeBuf.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Drop.java b/src/main/java/io/netty/buffer/b2/Drop.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Drop.java rename to src/main/java/io/netty/buffer/b2/Drop.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/ManagedAllocator.java b/src/main/java/io/netty/buffer/b2/ManagedAllocator.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/ManagedAllocator.java rename to src/main/java/io/netty/buffer/b2/ManagedAllocator.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/MemSegBuf.java b/src/main/java/io/netty/buffer/b2/MemSegBuf.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/MemSegBuf.java rename to src/main/java/io/netty/buffer/b2/MemSegBuf.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/MemoryManager.java b/src/main/java/io/netty/buffer/b2/MemoryManager.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/MemoryManager.java rename to src/main/java/io/netty/buffer/b2/MemoryManager.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/NativeMemoryCleanerDrop.java b/src/main/java/io/netty/buffer/b2/NativeMemoryCleanerDrop.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/NativeMemoryCleanerDrop.java rename to src/main/java/io/netty/buffer/b2/NativeMemoryCleanerDrop.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Owned.java b/src/main/java/io/netty/buffer/b2/Owned.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Owned.java rename to src/main/java/io/netty/buffer/b2/Owned.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Rc.java b/src/main/java/io/netty/buffer/b2/Rc.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Rc.java rename to src/main/java/io/netty/buffer/b2/Rc.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/RcSupport.java b/src/main/java/io/netty/buffer/b2/RcSupport.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/RcSupport.java rename to src/main/java/io/netty/buffer/b2/RcSupport.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/ResourceDisposeFailedException.java b/src/main/java/io/netty/buffer/b2/ResourceDisposeFailedException.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/ResourceDisposeFailedException.java rename to src/main/java/io/netty/buffer/b2/ResourceDisposeFailedException.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Scope.java b/src/main/java/io/netty/buffer/b2/Scope.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Scope.java rename to src/main/java/io/netty/buffer/b2/Scope.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Send.java b/src/main/java/io/netty/buffer/b2/Send.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Send.java rename to src/main/java/io/netty/buffer/b2/Send.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/SizeClassedMemoryPool.java b/src/main/java/io/netty/buffer/b2/SizeClassedMemoryPool.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/SizeClassedMemoryPool.java rename to src/main/java/io/netty/buffer/b2/SizeClassedMemoryPool.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/Statics.java b/src/main/java/io/netty/buffer/b2/Statics.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/Statics.java rename to src/main/java/io/netty/buffer/b2/Statics.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/TransferSend.java b/src/main/java/io/netty/buffer/b2/TransferSend.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/TransferSend.java rename to src/main/java/io/netty/buffer/b2/TransferSend.java diff --git a/buffer/src/main/java/io/netty/buffer/b2/package-info.java b/src/main/java/io/netty/buffer/b2/package-info.java similarity index 100% rename from buffer/src/main/java/io/netty/buffer/b2/package-info.java rename to src/main/java/io/netty/buffer/b2/package-info.java diff --git a/buffer/src/test/java/io/netty/buffer/b2/BufTest.java b/src/test/java/io/netty/buffer/b2/BufTest.java similarity index 100% rename from buffer/src/test/java/io/netty/buffer/b2/BufTest.java rename to src/test/java/io/netty/buffer/b2/BufTest.java diff --git a/buffer/src/test/java/io/netty/buffer/b2/Fixture.java b/src/test/java/io/netty/buffer/b2/Fixture.java similarity index 100% rename from buffer/src/test/java/io/netty/buffer/b2/Fixture.java rename to src/test/java/io/netty/buffer/b2/Fixture.java diff --git a/microbench/src/main/java/io/netty/buffer/MemSegBufAccessBenchmark.java b/src/test/java/io/netty/buffer/b2/MemSegBufAccessBenchmark.java similarity index 85% rename from microbench/src/main/java/io/netty/buffer/MemSegBufAccessBenchmark.java rename to src/test/java/io/netty/buffer/b2/MemSegBufAccessBenchmark.java index 0c4311c..25a562f 100644 --- a/microbench/src/main/java/io/netty/buffer/MemSegBufAccessBenchmark.java +++ b/src/test/java/io/netty/buffer/b2/MemSegBufAccessBenchmark.java @@ -13,11 +13,8 @@ * License for the specific language governing permissions and limitations * under the License. */ -package io.netty.buffer; +package io.netty.buffer.b2; -import io.netty.buffer.b2.Allocator; -import io.netty.buffer.b2.Buf; -import io.netty.microbench.util.AbstractMicrobenchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; @@ -25,7 +22,9 @@ import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.TearDown; import org.openjdk.jmh.annotations.Warmup; @@ -36,20 +35,15 @@ import java.util.concurrent.TimeUnit; @Fork(1) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -public class MemSegBufAccessBenchmark extends AbstractMicrobenchmark { +@State(Scope.Benchmark) +public class MemSegBufAccessBenchmark { public enum BBufType { - UNSAFE { + DIRECT { @Override Buf newBuffer() { return Allocator.direct().allocate(64); } }, -// UNSAFE_SLICE { -// @Override -// Buf newBuffer() { -// return UNSAFE.newBuffer().slice(16, 48); -// } -// }, HEAP { @Override Buf newBuffer() { @@ -75,7 +69,7 @@ public class MemSegBufAccessBenchmark extends AbstractMicrobenchmark { @Param public BBufType bufferType; - @Param({ "8" }) + @Param("8") public int batchSize; // applies only to readBatch benchmark @Setup @@ -92,17 +86,17 @@ public class MemSegBufAccessBenchmark extends AbstractMicrobenchmark { @Benchmark public long setGetLong() { - return buffer.writeLong(0, 1).readLong(0); + return buffer.setLong(0, 1).getLong(0); } @Benchmark public Buf setLong() { - return buffer.writeLong(0, 1); + return buffer.setLong(0, 1); } @Benchmark public int readBatch() { - buffer.readerIndex(0); + buffer.readerOffset(0); int result = 0; // WARNING! // Please do not replace this sum loop with a BlackHole::consume loop: diff --git a/buffer/src/test/java/io/netty/buffer/b2/ScopeTest.java b/src/test/java/io/netty/buffer/b2/ScopeTest.java similarity index 100% rename from buffer/src/test/java/io/netty/buffer/b2/ScopeTest.java rename to src/test/java/io/netty/buffer/b2/ScopeTest.java