org.openjdk.jmh.annotations.Group Java Examples

The following examples show how to use org.openjdk.jmh.annotations.Group. 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: FineGrainedWatermarkTrackerBenchmark.java    From incubator-gobblin with Apache License 2.0 6 votes vote down vote up
@Benchmark
@Group("scheduledDelayed")
public void scheduledDelayedAcks(Control control, TrackerState trackerState) throws Exception {
  if (!control.stopMeasurement) {
    final AcknowledgableWatermark wmark = new AcknowledgableWatermark(new DefaultCheckpointableWatermark(
        "0", new LongWatermark(trackerState._index)));
    trackerState._index++;
    int delay = trackerState._random.nextInt(10);
    trackerState._executorService.schedule(new Runnable() {
      @Override
      public void run() {
        wmark.ack();
      }
    }, delay, TimeUnit.MILLISECONDS);
  }
}
 
Example #2
Source File: JMHSample_18_Control.java    From jmh-playground with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("pingpong")
public void pong(Control cnt) {
    while (!cnt.stopMeasurement && !flag.compareAndSet(true, false)) {
        // this body is intentionally left blank
    }
}
 
Example #3
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 #4
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 #5
Source File: QueueThroughputBusy.java    From lin-check with GNU Lesser General Public License v3.0 5 votes vote down vote up
@GenerateMicroBenchmark
@Group("tpt")
public void offer(OpCounters counters) {
    if (!q.offer(ONE)) {
        counters.offerFail++;
    } 
    if (DELAY_PRODUCER != 0) {
        BlackHole.consumeCPU(DELAY_PRODUCER);
    }
}
 
Example #6
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 #7
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 #8
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 #9
Source File: QueueThroughputBusy.java    From lin-check with GNU Lesser General Public License v3.0 5 votes vote down vote up
@GenerateMicroBenchmark
@Group("tpt")
public void poll(OpCounters counters, ConsumerMarker cm) {
    if (q.poll() == null) {
        counters.pollFail++;
    } 
    if (DELAY_CONSUMER != 0) {
        BlackHole.consumeCPU(DELAY_CONSUMER);
    }
}
 
Example #10
Source File: JMHSample_18_Control.java    From jmh-playground with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("pingpong")
public void ping(Control cnt) {
    while (!cnt.stopMeasurement && !flag.compareAndSet(false, true)) {
        // this body is intentionally left blank
    }
}
 
Example #11
Source File: QueueThroughputYield.java    From lin-check with GNU Lesser General Public License v3.0 5 votes vote down vote up
@GenerateMicroBenchmark
@Group("tpt")
public void poll(OpCounters counters, ConsumerMarker cm) {
    if (q.poll() == null) {
        counters.pollFail++;
        Thread.yield();
    } 
    if (DELAY_CONSUMER != 0) {
        BlackHole.consumeCPU(DELAY_CONSUMER);
    }
}
 
Example #12
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_offer(OfferCounters counters) {
  if (queue.offer(Boolean.TRUE)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #13
Source File: QueueThroughputYield.java    From lin-check with GNU Lesser General Public License v3.0 5 votes vote down vote up
@GenerateMicroBenchmark
@Group("tpt")
public void offer(OpCounters counters) {
    if (!q.offer(ONE)) {
        counters.offerFail++;
        Thread.yield();
    } 
    if (DELAY_PRODUCER != 0) {
        BlackHole.consumeCPU(DELAY_PRODUCER);
    }
}
 
Example #14
Source File: JmhParkVsNotifyBenchmark.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Benchmark
@Group("condition")
public void wait0() throws InterruptedException {
    synchronized (mux) {
        mux.wait();
    }
}
 
Example #15
Source File: JmhParkVsNotifyBenchmark.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Benchmark
@Group("park")
public void park() {
    if (thread == null)
        thread = Thread.currentThread();

    LockSupport.park(thread);
}
 
Example #16
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 #17
Source File: ConnectableBufferOutputStreamBenchmark.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group
public void write(ProducerCounter counter) throws IOException {
    cbos.write(data);
    counter.producedBytes += dataSize;
    if (flushOnEach || r.nextInt(100) < 30) {
        cbos.flush();
        counter.flush++;
    }
}
 
Example #18
Source File: ConnectableBufferOutputStreamBenchmark.java    From servicetalk with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group
public void requestN(ConsumerCounter counter) {
    if (subscription == null) {
        toSource(publisher).subscribe(new Subscriber<Buffer>() {
            @Override
            public void onSubscribe(final Subscription s) {
                subscription = s;
            }

            @Override
            public void onNext(final Buffer buffer) {
                counter.consumedBytes += buffer.readableBytes();
                ++counter.onNext;
            }

            @Override
            public void onError(final Throwable t) {
            }

            @Override
            public void onComplete() {
            }
        });
    }
    subscription.request(1);
}
 
Example #19
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 #20
Source File: AbstractSizeBoundedQueueBenchmark.java    From buffer-slayer 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(next -> {
    counters.drained++;
    return true;
  });
}
 
Example #21
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 #22
Source File: AbstractSizeBoundedQueueBenchmark.java    From buffer-slayer 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(next -> {
    counters.drained++;
    return true;
  });
}
 
Example #23
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 #24
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 #25
Source File: FineGrainedWatermarkTrackerBenchmark.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
@Benchmark
@Group("trackImmediate")
public void trackImmediateAcks(Control control, TrackerState trackerState) throws Exception {
  if (!control.stopMeasurement) {
    AcknowledgableWatermark wmark = new AcknowledgableWatermark(new DefaultCheckpointableWatermark(
        "0", new LongWatermark(trackerState._index)));
    trackerState._watermarkTracker.track(wmark);
    trackerState._index++;
    wmark.ack();
  }
}
 
Example #26
Source File: StateQueueBenachmark.java    From tlaplus with MIT License 5 votes vote down vote up
@Benchmark
@Group("single")
@GroupThreads(2)
public TLCState[] consumerSingle() {
	final TLCState[] res = new TLCState[batch.length];
	for (int i = 0; i < batch.length; i++) {
		res[i] = this.s.sDequeue();
	}
    return res;
}
 
Example #27
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 #28
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 #29
Source File: ByteBoundedQueueBenchmarks.java    From zipkin-reporter-java 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 (q.offer(ONE, 1)) {
    counters.offersMade++;
  } else {
    counters.offersFailed++;
  }
}
 
Example #30
Source File: AsyncReporterBenchmarks.java    From zipkin-reporter-java with Apache License 2.0 4 votes vote down vote up
@Benchmark @Group("mild_contention") @GroupThreads(2)
public void mild_contention_report(InMemoryReporterMetricsAsCounters counters) {
  reporter.report(clientSpan);
}