Skip to content

Commit

Permalink
Add throughput mode for JMH benchmarking.
Browse files Browse the repository at this point in the history
Signed-off-by: Keshava Munegowda <[email protected]>
  • Loading branch information
kmgowda committed Jun 3, 2024
1 parent 5f9e836 commit 3f13d12
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions perl/src/jmh/java/io/perl/benchmark/QueueBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import io.perl.api.impl.CQueue;
import io.perl.api.impl.SyncQueue;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
Expand Down Expand Up @@ -53,6 +55,7 @@ public QueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
public void cqueueBenchmark() {
cqueue.add(1);
cqueue.poll();
Expand All @@ -63,6 +66,7 @@ public void cqueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
public void concurrentQueueBenchmark() {
clinkedQueue.add(1);
clinkedQueue.poll();
Expand All @@ -73,6 +77,7 @@ public void concurrentQueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
public void linkedBlockingQueueBenchmark() {
linkedbq.add(1);
linkedbq.poll();
Expand All @@ -83,6 +88,7 @@ public void linkedBlockingQueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
public void atomicQueueBenchmark() {
atomicQueue.add(1);
atomicQueue.poll();
Expand All @@ -94,6 +100,7 @@ public void atomicQueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
public void syncQueueBenchmark() {
syncQueue.add(1);
syncQueue.poll();
Expand All @@ -105,6 +112,7 @@ public void syncQueueBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
@Threads(10)
public void cqueueMultiThreadBenchmark() {
cqueue.add(10);
Expand All @@ -116,6 +124,7 @@ public void cqueueMultiThreadBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
@Threads(10)
public void concurrentQueueMultiThreadBenchmark() {
clinkedQueue.add(10);
Expand All @@ -127,6 +136,7 @@ public void concurrentQueueMultiThreadBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
@Threads(10)
public void linkedBlockingQueueMultiThreadBenchmark() {
linkedbq.add(10);
Expand All @@ -138,6 +148,7 @@ public void linkedBlockingQueueMultiThreadBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
@Threads(10)
public void atomicQueueMultiThreadBenchmark() {
atomicQueue.add(10);
Expand All @@ -149,6 +160,7 @@ public void atomicQueueMultiThreadBenchmark() {
@Timeout(time = 60)
@Warmup(iterations = 0)
@Measurement(iterations = 3)
@BenchmarkMode(Mode.Throughput)
@Threads(10)
public void syncQueueMultiThreadBenchmark() {
syncQueue.add(10);
Expand Down

0 comments on commit 3f13d12

Please sign in to comment.