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


Java Mode.SingleShotTime方法代码示例

本文整理汇总了Java中org.openjdk.jmh.annotations.Mode.SingleShotTime方法的典型用法代码示例。如果您正苦于以下问题:Java Mode.SingleShotTime方法的具体用法?Java Mode.SingleShotTime怎么用?Java Mode.SingleShotTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openjdk.jmh.annotations.Mode的用法示例。


在下文中一共展示了Mode.SingleShotTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: timeMergeAndBuild

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@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();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:21,代码来源:BuilderBenchmark.java

示例2: timeMergeAndBuildOriginalGM

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@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();    
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:19,代码来源:BuilderBenchmark.java

示例3: estimateTimeSingleFork

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
private long estimateTimeSingleFork(BenchmarkParams params) {
    IterationParams wp = params.getWarmup();
    IterationParams mp = params.getMeasurement();

    long estimatedTime;
    if (params.getMode() == Mode.SingleShotTime) {
        // No way to tell how long it will execute,
        // guess anything, and let ETA compensation to catch up.
        estimatedTime = (wp.getCount() + mp.getCount()) * TimeUnit.MILLISECONDS.toNanos(1);
    } else {
        estimatedTime =
                (wp.getCount() * wp.getTime().convertTo(TimeUnit.NANOSECONDS) +
                 mp.getCount() * mp.getTime().convertTo(TimeUnit.NANOSECONDS));
    }
    return estimatedTime;
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:17,代码来源:BaseRunner.java

示例4: measureRight

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@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;
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:9,代码来源:JMHSample_26_BatchSize.java

示例5: queryRya

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Timeout(time = 1, timeUnit = TimeUnit.HOURS)
public void queryRya() throws MalformedQueryException, QueryEvaluationException, SailException, NotEnoughResultsException {
    final QueryBenchmarkRun benchmark;

    if(numReads.equals( READ_ALL )) {
        benchmark = new QueryBenchmarkRun(sailConn, sparql);
    } else {
        benchmark = new QueryBenchmarkRun(sailConn, sparql, Long.parseLong(numReads));
    }

    benchmark.run();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:15,代码来源:QueryBenchmark.java

示例6: queryPerson

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
public void queryPerson() {
    try (Result<Person> results = data.select(Person.class).limit(10000).get()) {
        for (Person p : results) {
            p.getName();
        }
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:10,代码来源:BenchmarkTest.java

示例7: queryJdbc

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
public void queryJdbc() throws SQLException {
    try (Connection connection = dataSource.getConnection();
         PreparedStatement statement = connection.prepareStatement(
                 "SELECT id , name , email , birthday," +
                         " age, homepage, uuid FROM Person LIMIT 10000 ")) {

        try (ResultSet resultSet = statement.executeQuery()) {
            while (resultSet.next()) {
                resultSet.getLong(1); //id
                String name = resultSet.getString(2);
                String email = resultSet.getString(3);
                Date birthday = resultSet.getDate(4);
                Integer age = resultSet.getInt(5);
                String home = resultSet.getString(6);
                byte[] uuid = resultSet.getBytes(7);

                Person p = new Person();
                p.setName(name);
                p.setEmail(email);
                p.setUUID(uuid == null ? null : UUID.nameUUIDFromBytes(uuid));
                p.setBirthday(birthday);
                p.setHomepage(home == null ? null : new URL(home));
                p.setAge(age);
            }
        }
    } catch (MalformedURLException e) {
        throw new RuntimeException();
    }
}
 
开发者ID:requery,项目名称:requery,代码行数:32,代码来源:BenchmarkTest.java

示例8: init

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = 0)
@Measurement(iterations = 1)
public void init(@SuppressWarnings("unused") ReadOnlyRunnerState state) {
    // Let setup and tear down methods create resource and stores
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:8,代码来源:Runner.java

示例9: create

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = 0)
@Measurement(iterations = 1)
@OutputTimeUnit(TimeUnit.SECONDS)
public void create(RunnerState state) throws Exception {
    state.getBackend().createTempStore(state.getResourceFile());
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:9,代码来源:Runner.java

示例10: timeHashCodeOnce

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@Warmup(iterations = 0)
@Measurement(iterations = 1)
public void timeHashCodeOnce(Blackhole bh) {
  bh.consume(testMap.hashCode());
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:8,代码来源:JmhMapBenchmarks.java

示例11: timeMergeAndBuildOriginalDM

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@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 timeMergeAndBuildOriginalDM() {
  dummy = ++dummy % Integer.MAX_VALUE;
  
  com.google.protobuf.DynamicMessage.Builder builder = com.google.protobuf.DynamicMessage
      .newBuilder(expectedMessage);
  
  com.google.protobuf.DynamicMessage.Builder starBuilder = com.google.protobuf.DynamicMessage
      .newBuilder((Message) builder.getRepeatedField(galaxyStar, 0));
  
  Message planetMessage = (Message) starBuilder
      .setField(MessageAdapter.getFieldDescriptor(starBuilder, "name"), String.valueOf(dummy))
      .mergeFrom(mergeStar1Message)
      .getRepeatedField(starPlanet, 0);
  planetMessage = com.google.protobuf.DynamicMessage
      .newBuilder(planetMessage)
      .mergeFrom(mergePlanet1Message).build();
  
  Message actualMessage = builder.setRepeatedField(
      galaxyStar, 
      0, 
      starBuilder.setRepeatedField(starPlanet, 0, planetMessage).build())
      .build();
  return actualMessage;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:31,代码来源:BuilderBenchmark.java

示例12: test

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, batchSize = WARMUP_BATCH)
@Measurement(iterations = MEASUREMENT_ITERATIONS, batchSize = MEASUREMENT_BATCH)
@BenchmarkMode(Mode.SingleShotTime)
@Fork(1)
public void test() {
    Fixtures.work();
    batchCount.incrementAndGet();
}
 
开发者ID:msteindorfer,项目名称:jmh,代码行数:10,代码来源:SingleShotBatchAnn15Test.java

示例13: measureSingleShot

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode(Mode.SingleShotTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void measureSingleShot() throws InterruptedException {
    TimeUnit.MILLISECONDS.sleep(100);
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:7,代码来源:JMHSample_02_BenchmarkModes.java

示例14: measureMultiple

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@BenchmarkMode({Mode.Throughput, Mode.AverageTime, Mode.SampleTime, Mode.SingleShotTime})
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void measureMultiple() throws InterruptedException {
    TimeUnit.MILLISECONDS.sleep(100);
}
 
开发者ID:mumudemo,项目名称:mumu-benchmark,代码行数:7,代码来源:JMHSample_02_BenchmarkModes.java

示例15: singleShot

import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@Warmup(iterations = 0)
@BenchmarkMode(Mode.SingleShotTime)
public void singleShot() throws InterruptedException {
    Thread.sleep(50);
}
 
开发者ID:jzillmann,项目名称:gradle-jmh-report,代码行数:7,代码来源:MixedBenchmark.java


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