当前位置: 首页>>代码示例>>Java>>正文


Java Threads类代码示例

本文整理汇总了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);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:19,代码来源:Ids.java

示例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);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:19,代码来源:Ids.java

示例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);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:19,代码来源:Ids.java

示例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);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:20,代码来源:Ids.java

示例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();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:19,代码来源:BenchmarkGenerator.java

示例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() );
	}
}
 
开发者ID:hibernate,项目名称:beanvalidation-benchmark,代码行数:15,代码来源:ParsingBeansSpeedBenchmark.java

示例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 );
	}
}
 
开发者ID:hibernate,项目名称:beanvalidation-benchmark,代码行数:14,代码来源:RawValidationSpeedBenchmark.java

示例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);
}
 
开发者ID:cloudwall,项目名称:libcwfincore,代码行数:8,代码来源:ArrayBackedResourcePoolBenchmark.java

示例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);
    }
}
 
开发者ID:cloudwall,项目名称:libcwfincore,代码行数:10,代码来源:ArrayBackedResourcePoolBenchmark.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:9,代码来源:BulkheadBenchmark.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:9,代码来源:BulkheadBenchmark.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:9,代码来源:BulkheadBenchmark.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:9,代码来源:RateLimiterBenchmark.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:9,代码来源:RateLimiterBenchmark.java

示例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();
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:JmhFutureAdapterBenchmark.java


注:本文中的org.openjdk.jmh.annotations.Threads类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。