org.openjdk.jmh.annotations.GroupThreads Java Examples

The following examples show how to use org.openjdk.jmh.annotations.GroupThreads. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MpscProxyChannelBenchmark.java    From JCTools with Apache License 2.0 6 votes vote down vote up
@Benchmark
@Group("tenMixedArgs")
@GroupThreads(PRODUCER_THREADS)
public boolean tenMixedArgsCaller(final Control control, final CallerCounters counters) {
    this.waitStrategy.control = control;
    try {
        this.proxy.tenMixedArgs(this.intArg,
                this.objArg,
                this.longArg,
                this.customType0,
                this.doubleArg,
                this.customType1,
                this.floatArg,
                this.customType2,
                this.booleanArg,
                this.customType3);
        counters.callsFailed = this.waitStrategy.retries;
        return true;
    } catch (final StoppedException e) {
        return false;
    }
}
 
Example #2
Source File: ReadBufferBenchmark.java    From caffeine with Apache License 2.0 6 votes vote down vote up
@Benchmark @Group @GroupThreads(8)
public void record(RecordCounter counters) {
  switch (buffer.offer(Boolean.TRUE)) {
    case ReadBuffer.FAILED:
      counters.recordFailed++;
      break;
    case ReadBuffer.SUCCESS:
      counters.recordSuccess++;
      break;
    case ReadBuffer.FULL:
      counters.recordFull++;
      break;
    default:
      throw new IllegalStateException();
  }
}
 
Example #3
Source File: MpscProxyChannelBenchmark.java    From JCTools with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("alignedPrimitiveArgs")
@GroupThreads(PRODUCER_THREADS)
public boolean alignedPrimitiveArgsCaller(final Control control, final CallerCounters counters) {
    this.waitStrategy.control = control;
    try {
        this.proxy.alignedPrimitiveArgs(intArg,
                longArg,
                doubleArg,
                longArg2,
                doubleArg2,
                longArg3,
                doubleArg3,
                longArg4,
                doubleArg4,
                longArg,
                doubleArg,
                longArg2,
                doubleArg2,
                longArg3,
                doubleArg3,
                longArg4,
                doubleArg4);
        counters.callsFailed = this.waitStrategy.retries;
        return true;
    } catch (final StoppedException e) {
        return false;
    }
}
 
Example #4
Source File: AbstractReferenceCountedByteBufBenchmark.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public boolean retainReleaseContended() {
    buf.retain();
    Blackhole.consumeCPU(delay);
    return buf.release();
}
 
Example #5
Source File: VarHandleGeneratorBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
Example #6
Source File: MethodHandleGeneratorBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
Example #7
Source File: AttachDetachBenchmark.java    From grpc-nebula-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public int attachDetach() {
  Context old = cu.attach();
  try {
    return key.get();
  } finally {
    Context.current().detach(old);
  }
}
 
Example #8
Source File: AbstractSizeBoundedQueueBenchmark.java    From buffer-slayer with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(1)
public void mild_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo(next -> {
    counters.drained++;
    return true;
  });
}
 
Example #9
Source File: ByteBoundedQueueBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_offer(OfferCounters counters) {
  if (q.offer(ONE, 1)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #10
Source File: ByteBoundedQueueBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo((s, b) -> {
    counters.drained++;
    return true;
  }, 1000);
}
 
Example #11
Source File: ByteBoundedQueueBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("high_contention") @GroupThreads(8)
public void high_contention_offer(OfferCounters counters) {
  if (q.offer(ONE, 1)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #12
Source File: ByteBoundedQueueBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("high_contention") @GroupThreads(1)
public void high_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo((s, b) -> {
    counters.drained++;
    return true;
  }, 1000);
}
 
Example #13
Source File: StateQueueBenachmark.java    From tlaplus with MIT License 5 votes vote down vote up
@Benchmark
  @Group("single")
  @GroupThreads(2)
  public void producerSingle() {
  	for (int i = 0; i < batch.length; i++) {
  		this.s.sEnqueue(batch[i]);
}
  }
 
Example #14
Source File: StateQueueBenachmark.java    From tlaplus with MIT License 5 votes vote down vote up
@Benchmark
@Group("batchasym")
@GroupThreads(2)
public TLCState[] consumerBatch() {
	final TLCState[] res = new TLCState[batch.length];
	for (int i = 0; i < batch.length; i++) {
		res[i] = this.s.sDequeue();
	}
    return res;
}
 
Example #15
Source File: MpscProxyChannelBenchmark.java    From JCTools with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("unalignedPrimitiveArgs")
@GroupThreads(PRODUCER_THREADS)
public boolean unalignedPrimitiveArgsCaller(final Control control, final CallerCounters counters) {
    this.waitStrategy.control = control;
    try {
        this.proxy.unalignedPrimitiveArgs(
                longArg,
                doubleArg,
                longArg2,
                doubleArg2,
                longArg3,
                doubleArg3,
                longArg4,
                doubleArg4,
                longArg,
                doubleArg,
                longArg2,
                doubleArg2,
                longArg3,
                doubleArg3,
                longArg4,
                doubleArg4,
                intArg);
        counters.callsFailed = this.waitStrategy.retries;
        return true;
    } catch (final StoppedException e) {
        return false;
    }
}
 
Example #16
Source File: JmhParkVsNotifyBenchmark.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Benchmark
@GroupThreads(THREAD_COUNT)
@Group("park")
public void unpark() {
    LockSupport.unpark(thread);
}
 
Example #17
Source File: JmhParkVsNotifyBenchmark.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Benchmark
@Group("condition")
@GroupThreads(THREAD_COUNT)
public void notifyAll0() {
    synchronized (mux) {
        mux.notify();
    }
}
 
Example #18
Source File: SingleConsumerQueueBenchmark.java    From caffeine with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
Example #19
Source File: SingleConsumerQueueBenchmark.java    From caffeine with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(2)
public void mild_contention_offer(OfferCounters counters) {
  if (queue.offer(Boolean.TRUE)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #20
Source File: SingleConsumerQueueBenchmark.java    From caffeine with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(1)
public void mild_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
Example #21
Source File: SingleConsumerQueueBenchmark.java    From caffeine with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("high_contention") @GroupThreads(8)
public void high_contention_offer(OfferCounters counters) {
  if (queue.offer(Boolean.TRUE)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #22
Source File: SingleConsumerQueueBenchmark.java    From caffeine with Apache License 2.0 5 votes vote down vote up
@Benchmark @Group("high_contention") @GroupThreads(1)
public void high_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
Example #23
Source File: AttachDetachBenchmark.java    From grpc-java with Apache License 2.0 5 votes vote down vote up
/**
 * Javadoc comment.
 */
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public int attachDetach() {
  Context old = cu.attach();
  try {
    return key.get();
  } finally {
    Context.current().detach(old);
  }
}
 
Example #24
Source File: MpscProxyChannelBenchmark.java    From JCTools with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("oneObjectArg")
@GroupThreads(PRODUCER_THREADS)
public boolean oneObjectArgCaller(final Control control, final CallerCounters counters) {
    this.waitStrategy.control = control;
    try {
        this.proxy.oneObjectArg(this.objArg);
        counters.callsFailed = this.waitStrategy.retries;
        return true;
    } catch (final StoppedException e) {
        return false;
    }
}
 
Example #25
Source File: MpscProxyChannelBenchmark.java    From JCTools with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("onePrimitiveArg")
@GroupThreads(PRODUCER_THREADS)
public boolean onePrimitiveArgCaller(final Control control, final CallerCounters counters) {
    this.waitStrategy.control = control;
    try {
        this.proxy.onePrimitiveArg(this.intArg);
        counters.callsFailed = this.waitStrategy.retries;
        return true;
    } catch (final StoppedException e) {
        return false;
    }
}
 
Example #26
Source File: VolatileGeneratorBenchmark.java    From perfmark with Apache License 2.0 5 votes vote down vote up
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
Example #27
Source File: PlatformBenchmarks.java    From brave with Apache License 2.0 4 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(2)
public long mild_contention_nextTraceIdHigh_jre7() {
  return jre7.nextTraceIdHigh();
}
 
Example #28
Source File: ServletRuntimeBenchmarks.java    From brave with Apache License 2.0 4 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(2)
public int mild_contention_status_reflection() throws Exception {
  return threeStatusesReflection();
}
 
Example #29
Source File: PutRemoveBenchmark.java    From caffeine with Apache License 2.0 4 votes vote down vote up
@Benchmark @Group @GroupThreads(4)
public void put(ThreadState threadState) {
  cache.put(ints[threadState.index++ & MASK], Boolean.TRUE);
}
 
Example #30
Source File: GetPutBenchmark.java    From caffeine with Apache License 2.0 4 votes vote down vote up
@Benchmark @Group("readwrite") @GroupThreads(2)
public void readwrite_put(ThreadState threadState) {
  cache.put(ints[threadState.index++ & MASK], Boolean.TRUE);
}