當前位置: 首頁>>代碼示例>>Java>>正文


Java Warmup類代碼示例

本文整理匯總了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();
}
 
開發者ID:msteindorfer,項目名稱:jmh,代碼行數:19,代碼來源:BenchmarkGenerator.java

示例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;
}
 
開發者ID:mumudemo,項目名稱:mumu-benchmark,代碼行數:9,代碼來源:JMHSample_26_BatchSize.java

示例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;
}
 
開發者ID:mumudemo,項目名稱:mumu-benchmark,代碼行數:9,代碼來源:JMHSample_26_BatchSize.java

示例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;
}
 
開發者ID:mumudemo,項目名稱:mumu-benchmark,代碼行數:9,代碼來源:JMHSample_26_BatchSize.java

示例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() );
	}
}
 
開發者ID:hibernate,項目名稱:beanvalidation-benchmark,代碼行數:15,代碼來源:ParsingBeansSpeedBenchmark.java

示例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 );
	}
}
 
開發者ID:hibernate,項目名稱:beanvalidation-benchmark,代碼行數:14,代碼來源:RawValidationSpeedBenchmark.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:SimpleSyncBenchmark.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:ArrayListBenchmark.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:ArrayListBenchmark.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:ArrayListBenchmark.java

示例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);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:ConcurrentSkipListBenchmark.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:HashBenchmark.java

示例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]);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:MathFunctionBenchmark.java

示例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]);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:MathFunctionBenchmark.java

示例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]);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:MathFunctionBenchmark.java


注:本文中的org.openjdk.jmh.annotations.Warmup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。