org.openjdk.jmh.annotations.Group#org.openjdk.jmh.annotations.GroupThreads源码实例Demo

下面列出了org.openjdk.jmh.annotations.Group#org.openjdk.jmh.annotations.GroupThreads 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: caffeine   文件: ReadBufferBenchmark.java
@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();
  }
}
 
源代码2 项目: JCTools   文件: MpscProxyChannelBenchmark.java
@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;
    }
}
 
源代码3 项目: grpc-nebula-java   文件: AttachDetachBenchmark.java
/**
 * 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);
  }
}
 
源代码4 项目: perfmark   文件: VolatileGeneratorBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
源代码5 项目: perfmark   文件: MethodHandleGeneratorBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
源代码6 项目: perfmark   文件: VarHandleGeneratorBenchmark.java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(3)
public long racyGetAndSetAndGetGeneration() {
  long oldGeneration = generator.getGeneration();
  generator.setGeneration(oldGeneration + 1);
  return generator.getGeneration();
}
 
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public boolean retainReleaseContended() {
    buf.retain();
    Blackhole.consumeCPU(delay);
    return buf.release();
}
 
@Benchmark @Group("mild_contention") @GroupThreads(1)
public void mild_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo(next -> {
    counters.drained++;
    return true;
  });
}
 
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_offer(OfferCounters counters) {
  if (q.offer(ONE, 1)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo((s, b) -> {
    counters.drained++;
    return true;
  }, 1000);
}
 
@Benchmark @Group("high_contention") @GroupThreads(8)
public void high_contention_offer(OfferCounters counters) {
  if (q.offer(ONE, 1)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
@Benchmark @Group("high_contention") @GroupThreads(1)
public void high_contention_drain(DrainCounters counters, ConsumerMarker cm) {
  q.drainTo((s, b) -> {
    counters.drained++;
    return true;
  }, 1000);
}
 
源代码13 项目: tlaplus   文件: StateQueueBenachmark.java
@Benchmark
  @Group("single")
  @GroupThreads(2)
  public void producerSingle() {
  	for (int i = 0; i < batch.length; i++) {
  		this.s.sEnqueue(batch[i]);
}
  }
 
源代码14 项目: tlaplus   文件: StateQueueBenachmark.java
@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;
}
 
源代码15 项目: JCTools   文件: MpscProxyChannelBenchmark.java
@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;
    }
}
 
源代码16 项目: ignite   文件: JmhParkVsNotifyBenchmark.java
/**
 *
 */
@Benchmark
@GroupThreads(THREAD_COUNT)
@Group("park")
public void unpark() {
    LockSupport.unpark(thread);
}
 
源代码17 项目: ignite   文件: JmhParkVsNotifyBenchmark.java
/**
 *
 */
@Benchmark
@Group("condition")
@GroupThreads(THREAD_COUNT)
public void notifyAll0() {
    synchronized (mux) {
        mux.notify();
    }
}
 
源代码18 项目: caffeine   文件: SingleConsumerQueueBenchmark.java
@Benchmark @Group("no_contention") @GroupThreads(1)
public void no_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
源代码19 项目: caffeine   文件: SingleConsumerQueueBenchmark.java
@Benchmark @Group("mild_contention") @GroupThreads(2)
public void mild_contention_offer(OfferCounters counters) {
  if (queue.offer(Boolean.TRUE)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
源代码20 项目: caffeine   文件: SingleConsumerQueueBenchmark.java
@Benchmark @Group("mild_contention") @GroupThreads(1)
public void mild_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
源代码21 项目: caffeine   文件: SingleConsumerQueueBenchmark.java
@Benchmark @Group("high_contention") @GroupThreads(8)
public void high_contention_offer(OfferCounters counters) {
  if (queue.offer(Boolean.TRUE)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
源代码22 项目: caffeine   文件: SingleConsumerQueueBenchmark.java
@Benchmark @Group("high_contention") @GroupThreads(1)
public void high_contention_poll(PollCounters counters) {
  if (queue.poll() == null) {
    counters.pollsFailed++;
  } else {
    counters.pollsMade++;
  }
}
 
源代码23 项目: grpc-java   文件: AttachDetachBenchmark.java
/**
 * 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);
  }
}
 
源代码24 项目: JCTools   文件: MpscProxyChannelBenchmark.java
@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;
    }
}
 
源代码25 项目: JCTools   文件: MpscProxyChannelBenchmark.java
@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;
    }
}
 
源代码26 项目: JCTools   文件: MpscProxyChannelBenchmark.java
@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;
    }
}
 
源代码27 项目: brave   文件: ServletRuntimeBenchmarks.java
@Benchmark @Group("mild_contention") @GroupThreads(2)
public int mild_contention_httpResponse_servlet3() {
  return threeResponses(servlet3);
}
 
@Benchmark
@Group("c1p4")
@GroupThreads(1)
public void c1p4Consumer(Test test) throws InterruptedException {
   test.consumer().take();
}
 
源代码29 项目: brave   文件: PlatformBenchmarks.java
@Benchmark @Group("high_contention") @GroupThreads(8)
public long high_contention_randomLong_jre6() {
  return jre6.randomLong();
}
 
源代码30 项目: jmh-playground   文件: JMHSample_15_Asymmetric.java
@Benchmark
@Group("g")
@GroupThreads(1)
public int get() {
    return counter.get();
}