本文整理汇总了Java中org.openjdk.jmh.infra.Control类的典型用法代码示例。如果您正苦于以下问题:Java Control类的具体用法?Java Control怎么用?Java Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Control类属于org.openjdk.jmh.infra包,在下文中一共展示了Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: timerThroughputTest
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
public void timerThroughputTest(Control ctrl) throws InterruptedException {
counterDown.set(times);
for (int i = 0; i < times; i++) {
timer.schedule(new Runnable() {
@Override
public void run() {
counterDown.decrementAndGet();
}
},
delay,
TimeUnit.MILLISECONDS);
}
while (!ctrl.stopMeasurement && counterDown.get() > 0) {
// spin
}
}
示例2: trackWithDelayedAcks
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
@Group("trackDelayed")
public void trackWithDelayedAcks(Control control, TrackerState trackerState) throws Exception {
if (!control.stopMeasurement) {
final AcknowledgableWatermark wmark = new AcknowledgableWatermark(new DefaultCheckpointableWatermark(
"0", new LongWatermark(trackerState._index)));
trackerState._watermarkTracker.track(wmark);
trackerState._index++;
int delay = trackerState._random.nextInt(10);
trackerState._executorService.schedule(new Runnable() {
@Override
public void run() {
wmark.ack();
}
}, delay, TimeUnit.MILLISECONDS);
}
}
示例3: scheduledDelayedAcks
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@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);
}
}
示例4: scheduledNoRandomDelayedAcks
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
@Group("scheduledNoRandom")
public void scheduledNoRandomDelayedAcks(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 = 10;
trackerState._executorService.schedule(new Runnable() {
@Override
public void run() {
wmark.ack();
}
}, delay, TimeUnit.MILLISECONDS);
}
}
示例5: tenMixedArgsCaller
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@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;
}
}
示例6: ping
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
@Group("pingpong")
public void ping(Control cnt) {
while (!cnt.stopMeasurement && !flag.compareAndSet(false, true)) {
// this body is intentionally left blank
}
}
示例7: pong
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
@Group("pingpong")
public void pong(Control cnt) {
while (!cnt.stopMeasurement && !flag.compareAndSet(true, false)) {
// this body is intentionally left blank
}
}
示例8: multiTimerTest
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Benchmark
public void multiTimerTest(Control ctrl) throws InterruptedException {
int threads = 10;
counterDown.set(times * threads);
for (int i = 0; i < threads; i++) {
final int idx = i;
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(10 * idx);
} catch (InterruptedException e) {
}
for (int j = 0; j < times; j++) {
timer.schedule(new Runnable() {
@Override
public void run() {
counterDown.decrementAndGet();
}
},
delay,
TimeUnit.MILLISECONDS);
}
}
}).start();
}
while (!ctrl.stopMeasurement && counterDown.get() > 0) {
// spin
}
}
示例9: timerThroughputTest
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
public void timerThroughputTest(Control ctrl) throws InterruptedException {
counterDown.set(times);
for (int i = 0; i < times; i++) {
timer.newTimeout((TimerTask) (v) -> counterDown.decrementAndGet(),
delay,
TimeUnit.MILLISECONDS);
}
while (!ctrl.stopMeasurement && counterDown.get() > 0) {
// spin
}
}
示例10: send1
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("mpsc")
@GroupThreads(1)
@Benchmark
public void send1(Control control) {
final MpscLinkedArrayQueue<Integer> q = queue;
while (!q.offer(1) && !control.stopMeasurement) {
}
}
示例11: recv1
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("mpsc")
@GroupThreads(1)
@Benchmark
public void recv1(Control control) {
final MpscLinkedArrayQueue<Integer> q = queue;
while (!control.stopMeasurement && q.poll() == null) {
;
}
}
示例12: send2
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("spscLinked")
@GroupThreads(1)
@Benchmark
public void send2(Control control) {
final SpscLinkedArrayQueue<Integer> q = q2;
while (!q.offer(1) && !control.stopMeasurement) {
}
}
示例13: recv2
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("spscLinked")
@GroupThreads(1)
@Benchmark
public void recv2(Control control) {
final SpscLinkedArrayQueue<Integer> q = q2;
while (!control.stopMeasurement && q.poll() == null) {
;
}
}
示例14: send3
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("spsc")
@GroupThreads(1)
@Benchmark
public void send3(Control control) {
final SpscArrayQueue<Integer> q = q3;
while (!q.offer(1) && !control.stopMeasurement) {
}
}
示例15: recv3
import org.openjdk.jmh.infra.Control; //导入依赖的package包/类
@Group("spsc")
@GroupThreads(1)
@Benchmark
public void recv3(Control control) {
final SpscArrayQueue<Integer> q = q3;
while (!control.stopMeasurement && q.poll() == null) {
;
}
}