本文整理汇总了Java中org.openjdk.jmh.annotations.Warmup类的典型用法代码示例。如果您正苦于以下问题:Java Warmup类的具体用法?Java Warmup怎么用?Java Warmup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Warmup类属于org.openjdk.jmh.annotations包,在下文中一共展示了Warmup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateImport
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
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();
}
示例2: measureWrong_1
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@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;
}
示例3: measureWrong_5
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@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;
}
示例4: measureRight
import org.openjdk.jmh.annotations.Warmup; //导入依赖的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: testCascadedValidation
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@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() );
}
}
示例6: testCascadedValidation
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@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 );
}
}
示例7: getAndIncAge
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public int getAndIncAge(ThreadState state) {
Person person = state.person;
int oldAge = person.getAge();
person.setAge(oldAge + 1);
return oldAge;
}
示例8: addBoxedAndClear
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public void addBoxedAndClear(ThreadState state) {
for (int i = 0; i < N; ++i) {
state.list.add(i);
}
state.list.clear();
}
示例9: addNullAndClear
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public void addNullAndClear(ThreadState state) {
for (int i = 0; i < N; ++i) {
state.list.add(null);
}
state.list.clear();
}
示例10: addNull
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public void addNull(ClearedThreadState state) {
for (int i = 0; i < N; ++i) {
state.list.add(null);
}
}
示例11: addBoxed
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public void addBoxed(ThreadState state) {
for (int i = 0; i < N; ++i) {
state.list.put(i, i);
}
}
示例12: hash
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 20)
public int hash(ThreadState state) {
int value = 0;
char[] array = state.characters;
for (int i = 0; i < array.length; ++i) {
value = value * 31 + array[i];
}
return value;
}
示例13: mathLog
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 5)
public void mathLog(ThreadState state) {
double[] data = state.data;
for (int i = 0; i < data.length; i++) {
double[] result = state.result;
result[i] = Math.log(data[i]);
}
}
示例14: mathLog10
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 5)
public void mathLog10(ThreadState state) {
double[] data = state.data;
for (int i = 0; i < data.length; i++) {
double[] result = state.result;
result[i] = Math.log10(data[i]);
}
}
示例15: mathSin
import org.openjdk.jmh.annotations.Warmup; //导入依赖的package包/类
@Benchmark
@Warmup(iterations = 5)
public void mathSin(ThreadState state) {
double[] data = state.data;
for (int i = 0; i < data.length; i++) {
double[] result = state.result;
result[i] = Math.sin(data[i]);
}
}