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

项目:protobuf-el    文件:BuilderBenchmark.java   
@Benchmark
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime, Mode.SingleShotTime})
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MICROSECONDS)
@Measurement(iterations = ITERATIONS_COUNT, time = 1000, timeUnit = TimeUnit.MICROSECONDS)
@Fork(1)
public Message timeMergeAndBuild() {
  dummy = ++dummy % Integer.MAX_VALUE;

  Builder builder = newBuilder(expectedMessage)
      .getFieldBuilder(galaxyStar, 0)
          .setField(starName, String.valueOf(dummy))
          .mergeFrom(mergeStar1Message)
          .getFieldBuilder(starPlanet, 0)
              .mergeFrom(mergePlanet1Message)
              .toParent()
          .toParent();

  return builder.build();
}
项目:protobuf-el    文件:BuilderBenchmark.java   
@Benchmark
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime, Mode.SingleShotTime})
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Warmup(iterations = 5, time = 100, timeUnit = TimeUnit.MICROSECONDS)
@Measurement(iterations = ITERATIONS_COUNT, time = 1000, timeUnit = TimeUnit.MICROSECONDS)
@Fork(1)
public Galaxy timeMergeAndBuildOriginalGM() {
  dummy = ++dummy % Integer.MAX_VALUE;

  Galaxy.Builder builder = Galaxy.newBuilder((Galaxy) expectedMessage);
  builder.getStarBuilder(0)
      .setName(String.valueOf(dummy))
      .mergeFrom(mergeStar1Message)
      .getPlanetBuilder(0)
      .mergeFrom(mergePlanet1Message);

  return builder.build();    
}
项目:mumu-benchmark    文件:JMHSample_26_BatchSize.java   
@Benchmark
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 5, time = 1)
@BenchmarkMode(Mode.AverageTime)
public List<String> measureWrong_1() {
    list.add(list.size() / 2, "something");
    return list;
}
项目:mumu-benchmark    文件:JMHSample_26_BatchSize.java   
@Benchmark
@Warmup(iterations = 5, time = 5)
@Measurement(iterations = 5, time = 5)
@BenchmarkMode(Mode.AverageTime)
public List<String> measureWrong_5() {
    list.add(list.size() / 2, "something");
    return list;
}
项目:mumu-benchmark    文件:JMHSample_26_BatchSize.java   
@Benchmark
@Warmup(iterations = 5, batchSize = 5000)
@Measurement(iterations = 5, batchSize = 5000)
@BenchmarkMode(Mode.SingleShotTime)
public List<String> measureRight() {
    list.add(list.size() / 2, "something");
    return list;
}
项目: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 );
    }
}
项目:openjdk-jdk10    文件:SortingLongBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortNewWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        SortingLongTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
    }
}
项目:openjdk-jdk10    文件:SortingLongBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortOldWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        Arrays.sort(this.array);
    }
}
项目:openjdk-jdk10    文件:SortingIntBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortNewWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        SortingIntTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
    }
}
项目:openjdk-jdk10    文件:SortingIntBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortCurrentWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        Arrays.sort(this.array);
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInOneCommitBenchmark() throws Exception {
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);
    }
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
        writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);

        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
        cohort.canCommit().get();
        cohort.preCommit().get();
        cohort.commit().get();
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception {
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
    }
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
        writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
        cohort.canCommit().get();
        cohort.preCommit().get();
        cohort.commit().get();
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() throws Exception {
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) {
        writeTx.write(OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]);
    }
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryDatastoreWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) {
        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
        writeTx.write(OUTER_LIST_10K_PATHS[outerListKey], OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]);
        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
        cohort.canCommit().get();
        cohort.preCommit().get();
        cohort.commit().get();
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInOneCommitBenchmark() throws Exception {

    DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey],
                OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);
    }

    writeTx.submit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_100K_PATHS[outerListKey],
                OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);

        writeTx.submit().get();
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception {
    DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey],
                OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
    }

    writeTx.submit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_50K_PATHS[outerListKey],
                OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
        writeTx.submit().get();
    }
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write10KSingleNodeWithTenInnerItemsInOneCommitBenchmark() throws Exception {
    DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) {
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey],
                OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]);
    }
    writeTx.submit().get();
}
项目:hashsdn-controller    文件:AbstractInMemoryBrokerWriteTransactionBenchmark.java   
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write10KSingleNodeWithTenInnerItemsInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_10K; ++outerListKey) {
        DOMDataReadWriteTransaction writeTx = domBroker.newReadWriteTransaction();
        writeTx.put(LogicalDatastoreType.OPERATIONAL, OUTER_LIST_10K_PATHS[outerListKey],
                OUTER_LIST_TEN_ITEM_INNER_LIST[outerListKey]);
        writeTx.submit().get();
    }
}
项目:jvm-dynamic-optimizations-performance-test    文件:Nullness.java   
@Measurement(iterations = 100, time = 1, timeUnit = TimeUnit.SECONDS)
   @Benchmark
   public void testMethod(MyState s) throws Exception {
    String testInput = getTestValue(s);
    try {
        s.valueSink += safeUpper(testInput).hashCode();
    } catch (Exception e) {
        // Ignore.
    }
}
项目:openjdk9    文件:SortingLongBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortNewWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        SortingLongTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
    }
}
项目:openjdk9    文件:SortingLongBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortOldWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        Arrays.sort(this.array);
    }
}
项目:openjdk9    文件:SortingIntBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortNewWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        SortingIntTestJMH.sort(this.array, 0, this.array.length - 1, null, 0, 0);
    }
}
项目:openjdk9    文件:SortingIntBenchmarkTestJMH.java   
@Warmup(iterations = 20)
@Measurement(iterations = 10)
@Benchmark
public void sortCurrentWay() {
    for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
        Arrays.sort(this.array);
    }
}
项目:gradle-jmh-report    文件:MixedBenchmark.java   
@Benchmark
@Warmup(iterations = 1)
@BenchmarkMode(Mode.AverageTime)
@Measurement(iterations = 3)
public void avg() throws InterruptedException {
    Thread.sleep(50);
}
项目:gradle-jmh-report    文件:MixedBenchmark.java   
@Benchmark
@Warmup(iterations = 1)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@Measurement(iterations = 3, time = 1, timeUnit = TimeUnit.SECONDS)
public void throughput() throws InterruptedException {
    Thread.sleep(50);
}
项目:Zipkin    文件:HttpFilterBenchmarks.java   
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithoutSleuth(BenchmarkContext context)
        throws IOException, ServletException {
    MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
    MockHttpServletResponse response = new MockHttpServletResponse();
    response.setContentType(MediaType.APPLICATION_JSON_VALUE);

    context.dummyFilter.doFilter(request, response, new MockFilterChain());
}
项目:Zipkin    文件:HttpFilterBenchmarks.java   
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithSleuth(BenchmarkContext context)
        throws ServletException, IOException {
    MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
    MockHttpServletResponse response = new MockHttpServletResponse();
    response.setContentType(MediaType.APPLICATION_JSON_VALUE);

    context.traceFilter.doFilter(request, response, new MockFilterChain());
}
项目:spring-cloud-sleuth    文件:HttpFilterBenchmarks.java   
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithoutSleuth(BenchmarkContext context)
        throws IOException, ServletException {
    MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
    MockHttpServletResponse response = new MockHttpServletResponse();
    response.setContentType(MediaType.APPLICATION_JSON_VALUE);

    context.dummyFilter.doFilter(request, response, new MockFilterChain());
}
项目:spring-cloud-sleuth    文件:HttpFilterBenchmarks.java   
@Benchmark
@Measurement(iterations = 5, time = 1)
@Fork(3)
public void filterWithSleuth(BenchmarkContext context)
        throws ServletException, IOException {
    MockHttpServletRequest request = builder().buildRequest(new MockServletContext());
    MockHttpServletResponse response = new MockHttpServletResponse();
    response.setContentType(MediaType.APPLICATION_JSON_VALUE);

    context.traceFilter.doFilter(request, response, new MockFilterChain());
}
项目: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();
}