Java 类org.openjdk.jmh.annotations.Threads 实例源码

项目:spectator    文件:Ids.java   
@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);
}
项目:spectator    文件:Ids.java   
@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);
}
项目:spectator    文件:Ids.java   
@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);
}
项目:spectator    文件:Ids.java   
@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);
}
项目:jmh    文件:BenchmarkGenerator.java   
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();
}
项目:beanvalidation-benchmark    文件:ParsingBeansSpeedBenchmark.java   
@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() );
    }
}
项目:beanvalidation-benchmark    文件:RawValidationSpeedBenchmark.java   
@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 );
    }
}
项目:libcwfincore    文件:ArrayBackedResourcePoolBenchmark.java   
@Benchmark
@Threads(Threads.MAX)
public void measureNaiveObjectCreation() throws Exception {
    Thing thing = new Thing(1);
    things.add(thing);
    things.remove(thing);
}
项目:libcwfincore    文件:ArrayBackedResourcePoolBenchmark.java   
@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);
    }
}
项目:resilience4j    文件:BulkheadBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String directSupplier() {
    return stringSupplier.get();
}
项目:resilience4j    文件:BulkheadBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplier() {
    return protectedSupplier.get();
}
项目:resilience4j    文件:BulkheadBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplierWithSubscriber() {
    return protectedSupplierWithSb.get();
}
项目:resilience4j    文件:RateLimiterBenchmark.java   
@Benchmark
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Fork(value = FORK_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String semaphoreBasedPermission() {
    return semaphoreGuardedSupplier.get();
}
项目:resilience4j    文件:RateLimiterBenchmark.java   
@Benchmark
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Fork(value = FORK_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String atomicPermission() {
    return atomicGuardedSupplier.get();
}
项目:resilience4j    文件:CircuitBreakerBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String directSupplier() {
    return stringSupplier.get();
}
项目:resilience4j    文件:CircuitBreakerBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplier() {
    return protectedSupplier.get();
}
项目:resilience4j    文件:CircuitBreakerBenchmark.java   
@Benchmark
@Fork(value = FORK_COUNT)
@Threads(value = THREAD_COUNT)
@Warmup(iterations = WARMUP_COUNT)
@Measurement(iterations = ITERATION_COUNT)
public String protectedSupplierWithSubscriber() {
    return protectedSupplierWithSb.get();
}
项目:ignite    文件:JmhFutureAdapterBenchmark.java   
/**
 * @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();
}
项目:spectator    文件:Ids.java   
@Threads(1)
@Benchmark
public void append2(Blackhole bh) {
  Id id = baseId.withTags(
      "country", "US",
       "device", "xbox");
  bh.consume(id);
}
项目:spectator    文件:Ids.java   
@Threads(1)
@Benchmark
public void append4(Blackhole bh) {
  Id id = baseId.withTags(
      "country", "US",
       "device", "xbox",
       "status", "200",
       "client", "ab");
  bh.consume(id);
}
项目:spectator    文件:Ids.java   
@Threads(1)
@Benchmark
public void append4sorted(Blackhole bh) {
  Id id = baseId.withTags(
      "client", "ab",
     "country", "US",
      "device", "xbox",
      "status", "200");
  bh.consume(id);
}
项目:spectator    文件:Ids.java   
@Threads(1)
@Benchmark
public void emptyAppend2(Blackhole bh) {
  Id id = emptyId.withTags(
      "country", "US",
      "device", "xbox");
  bh.consume(id);
}
项目:spectator    文件:Ids.java   
@Threads(1)
@Benchmark
public void emptyAppend4sorted(Blackhole bh) {
  Id id = emptyId.withTags(
      "client", "ab",
      "country", "US",
      "device", "xbox",
      "status", "200");
  bh.consume(id);
}
项目:spectator    文件:StringForeach.java   
@Threads(1)
@Benchmark
public void arrayForLoop(Blackhole bh) {
  int v = 0;
  int n = arr.length;
  for (int i = 0; i < n; ++i) {
    v += arr[i];
  }
  bh.consume(v);
}
项目:spectator    文件:StringForeach.java   
@Threads(1)
@Benchmark
public void arrayForeach(Blackhole bh) {
  int v = 0;
  for (char c : arr) {
    v += c;
  }
  bh.consume(v);
}
项目:spectator    文件:StringForeach.java   
@Threads(1)
@Benchmark
public void strForLoop(Blackhole bh) {
  int v = 0;
  int n = str.length();
  for (int i = 0; i < n; ++i) {
    v += str.charAt(i);
  }
  bh.consume(v);
}
项目:jmh    文件:BenchmarkBenchSameThreadTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 5, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@Threads(4)
public void test() {
    testInvocationThread.add(Thread.currentThread());
    Fixtures.work();
}
项目:jmh    文件:BenchmarkBenchOrderTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@Threads(1)
public void test() {
    tickRun = TICKER.incrementAndGet();
    Fixtures.work();
}
项目:jmh    文件:ThreadBenchOrderTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@Threads(1)
public void test() {
    tickRun = TICKER.incrementAndGet();
    Fixtures.work();
}
项目:jmh    文件:BenchmarkStateOrderTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@Threads(1)
public void test(MyState state) {
    state.tickRun = TICKER.incrementAndGet();
    Fixtures.work();
}
项目:jmh    文件:ThreadStateOrderTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(1)
@Threads(1)
public void test(MyState state) {
    state.tickRun = TICKER.incrementAndGet();
    Fixtures.work();
}
项目:jmh    文件:FailingThreadBenchTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void doTest() {
    Assert.fail();
}
项目:jmh    文件:FailingThreadStateSetupTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test(MyState state) {
    Fixtures.work();
}
项目:jmh    文件:FailingBenchmarkBenchSetupTest.java   
@Benchmark
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test() {
    Fixtures.work();
}
项目:jmh    文件:FailingThreadBenchSetupTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test() {
    Fixtures.work();
}
项目:jmh    文件:FailingThreadBenchTearDownTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test() {
    Fixtures.work();
}
项目:jmh    文件:FailingBenchmarkBenchTearDownTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test() {
    Fixtures.work();
}
项目:jmh    文件:FailingForkedBenchTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void doTest() {
    Assert.fail();
}
项目:jmh    文件:FailingThreadStateTearDownTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test(MyState state) {
    Fixtures.work();
}
项目:jmh    文件:FailingBenchmarkStateTearDownTest.java   
@Benchmark
@BenchmarkMode(Mode.All)
@Warmup(iterations = 0)
@Measurement(iterations = 1, time = 1)
@Fork(1)
@Threads(4)
public void test(MyState state) {
    Fixtures.work();
}