當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。