本文整理汇总了Java中org.openjdk.jmh.annotations.Threads类的典型用法代码示例。如果您正苦于以下问题:Java Threads类的具体用法?Java Threads怎么用?Java Threads使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Threads类属于org.openjdk.jmh.annotations包,在下文中一共展示了Threads类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: baseline
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Threads(1)
@Benchmark
public void baseline(Blackhole bh) {
PrependId id = new PrependId("http.req.complete", null)
.withTag( "nf.app", "test_app")
.withTag("nf.cluster", "test_app-main")
.withTag( "nf.asg", "test_app-main-v042")
.withTag( "nf.stack", "main")
.withTag( "nf.ami", "ami-0987654321")
.withTag( "nf.region", "us-east-1")
.withTag( "nf.zone", "us-east-1e")
.withTag( "nf.node", "i-1234567890")
.withTag( "country", "US")
.withTag( "device", "xbox")
.withTag( "status", "200")
.withTag( "client", "ab");
bh.consume(id);
}
示例2: withTag
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Threads(1)
@Benchmark
public void withTag(Blackhole bh) {
Id id = registry.createId("http.req.complete")
.withTag( "nf.app", "test_app")
.withTag("nf.cluster", "test_app-main")
.withTag( "nf.asg", "test_app-main-v042")
.withTag( "nf.stack", "main")
.withTag( "nf.ami", "ami-0987654321")
.withTag( "nf.region", "us-east-1")
.withTag( "nf.zone", "us-east-1e")
.withTag( "nf.node", "i-1234567890")
.withTag( "country", "US")
.withTag( "device", "xbox")
.withTag( "status", "200")
.withTag( "client", "ab");
bh.consume(id);
}
示例3: withTagsVararg
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Threads(1)
@Benchmark
public void withTagsVararg(Blackhole bh) {
Id id = registry.createId("http.req.complete").withTags(
"nf.app", "test_app",
"nf.cluster", "test_app-main",
"nf.asg", "test_app-main-v042",
"nf.stack", "main",
"nf.ami", "ami-0987654321",
"nf.region", "us-east-1",
"nf.zone", "us-east-1e",
"nf.node", "i-1234567890",
"country", "US",
"device", "xbox",
"status", "200",
"client", "ab");
bh.consume(id);
}
示例4: withTagsVarargSorted
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Threads(1)
@Benchmark
public void withTagsVarargSorted(Blackhole bh) {
Id id = registry.createId("http.req.complete").withTags(
"client", "ab",
"country", "US",
"device", "xbox",
"nf.ami", "ami-0987654321",
"nf.app", "test_app",
"nf.asg", "test_app-main-v042",
"nf.cluster", "test_app-main",
"nf.node", "i-1234567890",
"nf.region", "us-east-1",
"nf.stack", "main",
"nf.zone", "us-east-1e",
"status", "200"
);
bh.consume(id);
}
示例5: generateImport
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
private void generateImport(PrintWriter writer) {
Class<?>[] imports = new Class<?>[]{
List.class, AtomicInteger.class,
Collection.class, ArrayList.class,
TimeUnit.class, Generated.class, CompilerControl.class,
InfraControl.class, ThreadParams.class,
Result.class, ThroughputResult.class, AverageTimeResult.class,
SampleTimeResult.class, SingleShotResult.class, SampleBuffer.class,
Mode.class, Fork.class, Measurement.class, Threads.class, Warmup.class,
BenchmarkMode.class, RawResults.class, ResultRole.class,
Field.class, BenchmarkParams.class, IterationParams.class
};
for (Class<?> c : imports) {
writer.println("import " + c.getName() + ';');
}
writer.println();
}
示例6: testCascadedValidation
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(value = 1)
@Threads(1)
@Warmup(iterations = 5)
@Measurement(iterations = 20)
public void testCascadedValidation(ParsingBeansSpeedState state, Blackhole bh) {
// Validator in new factory
for ( Object o : state.holder.beans ) {
bh.consume( state.validator.getConstraintsForClass( o.getClass() ).isBeanConstrained() );
}
}
示例7: testCascadedValidation
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@Threads(50)
@Warmup(iterations = 20) // it seems that as there are a lot of beans it takes some time to warmup
@Measurement(iterations = 30)
public void testCascadedValidation(RawValidationSpeedState state, Blackhole bh) {
for ( Object o : state.holder.beans ) {
Set<ConstraintViolation<Object>> constraintViolations = state.validator.validate( o );
bh.consume( constraintViolations );
}
}
示例8: measureNaiveObjectCreation
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Threads(Threads.MAX)
public void measureNaiveObjectCreation() throws Exception {
Thing thing = new Thing(1);
things.add(thing);
things.remove(thing);
}
示例9: measureAcquireAndReleaseMultithreaded
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Threads(Threads.MAX)
public void measureAcquireAndReleaseMultithreaded() throws Exception {
try (Resource<Thing> thingResource = pool.get()) {
Thing thing = thingResource.get();
assertNotNull(thing);
assertTrue(thing.getId() >= 1);
}
}
示例10: directSupplier
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String directSupplier() {
return stringSupplier.get();
}
示例11: protectedSupplier
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplier() {
return protectedSupplier.get();
}
示例12: protectedSupplierWithSubscriber
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplierWithSubscriber() {
return protectedSupplierWithSb.get();
}
示例13: semaphoreBasedPermission
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Fork(value = FORK_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String semaphoreBasedPermission() {
return semaphoreGuardedSupplier.get();
}
示例14: atomicPermission
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
@Benchmark
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Fork(value = FORK_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String atomicPermission() {
return atomicGuardedSupplier.get();
}
示例15: completeFutureGet
import org.openjdk.jmh.annotations.Threads; //导入依赖的package包/类
/**
* @param state Benchmark context.
* @throws Exception If failed.
*/
@Benchmark
@Threads(4)
public void completeFutureGet(CompleteState state) throws Exception {
GridFutureAdapter<Long> fut = new GridFutureAdapter<>();
state.queue.put(fut);
fut.get();
}