本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
}
}
示例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();
}
}
示例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
}
示例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());
}
示例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());
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例15: singleShot
import org.openjdk.jmh.annotations.Mode; //导入方法依赖的package包/类
@Benchmark
@Warmup(iterations = 0)
@BenchmarkMode(Mode.SingleShotTime)
public void singleShot() throws InterruptedException {
Thread.sleep(50);
}