本文整理汇总了Java中org.openjdk.jmh.profile.GCProfiler类的典型用法代码示例。如果您正苦于以下问题:Java GCProfiler类的具体用法?Java GCProfiler怎么用?Java GCProfiler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GCProfiler类属于org.openjdk.jmh.profile包,在下文中一共展示了GCProfiler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runMicroBenchMark
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
@Test
public void runMicroBenchMark() throws RunnerException {
Options opt = new OptionsBuilder()
.include(getClass().getName())
.warmupIterations(2)
.measurementIterations(10)
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.MILLISECONDS)
.addProfiler(GCProfiler.class)
.jvmArgs("-server", "-XX:+UseG1GC", "-Xmx256m")
.shouldDoGC(true)
.forks(1)
.build();
new Runner(opt).run();
}
示例2: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
//System.setProperty("com.zaxxer.nuprocess.threads", "cores"); // set when running with forks(0) below
Options options = new OptionsBuilder()
.addProfiler(GCProfiler.class)
.addProfiler(HotspotThreadProfiler.class)
//.forks(0) // set when running with JProfiler to simplify profiling
.forks(2)
//.jvmArgsAppend("-Dcom.zaxxer.nuprocess.threads=cores") // to adjust the pump thread count
.include(NuProcessBenchmark.class.getSimpleName())
.measurementIterations(50)
.threads(10)
.timeUnit(TimeUnit.SECONDS)
.warmupIterations(1)
.build();
new Runner(options).run();
}
示例3: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
@SuppressWarnings("ObjectAllocationInLoop") public static void main(final String[] args)
throws RunnerException {
final ChainedOptionsBuilder options =
new OptionsBuilder().addProfiler(HotspotThreadProfiler.class)
.addProfiler(HotspotRuntimeProfiler.class).addProfiler(HotspotMemoryProfiler.class)
.addProfiler(GCProfiler.class).addProfiler(StackProfiler.class).shouldFailOnError(true)
.forks(1).resultFormat(ResultFormatType.CSV).detectJvmArgs();
for (int nThreads = 1; nThreads <= 2; nThreads++) {
new Runner(
options.threads(nThreads).output(String.format("%d-thread_bench_results.csv", nThreads))
.build()).run();
}
}
示例4: runBenchmark
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void runBenchmark(Class<?> benchmarkClass) throws RunnerException
{
final Options opt = new OptionsBuilder()
.include(benchmarkClass.getSimpleName())
.addProfiler(GCProfiler.class)
.shouldDoGC(true)
.warmupIterations(5)
.measurementIterations(5)
.forks(1)
.build();
new Runner(opt).run();
}
示例5: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options options = new OptionsBuilder()
.threads(2)
.addProfiler(GCProfiler.class)
.build();
new Runner(options).run();
}
示例6: run
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
/**
* Run benchmark.
*
* @param benchmark Benchmark to run.
* @param threads Amount of threads.
* @param client Client mode flag.
* @param atomicityMode Atomicity mode.
* @param writeSyncMode Write synchronization mode.
* @throws Exception If failed.
*/
private static void run(String benchmark, int threads, boolean client, CacheAtomicityMode atomicityMode,
CacheWriteSynchronizationMode writeSyncMode) throws Exception {
String simpleClsName = JmhCacheBenchmark.class.getSimpleName();
String output = simpleClsName + "-" + benchmark +
"-" + threads + "-threads" +
"-" + (client ? "client" : "data") +
"-" + atomicityMode +
"-" + writeSyncMode;
JmhIdeBenchmarkRunner.create()
.forks(1)
.threads(threads)
.warmupIterations(10)
.measurementIterations(60)
.benchmarks(simpleClsName + "." + benchmark)
.output(output + ".jmh.log")
.profilers(GCProfiler.class)
.jvmArguments(
"-Xms4g",
"-Xmx4g",
"-XX:+UnlockCommercialFeatures",
"-XX:+FlightRecorder",
"-XX:StartFlightRecording=delay=30s,dumponexit=true,settings=alloc,filename=" + output + ".jfr",
JmhIdeBenchmarkRunner.createProperty(PROP_ATOMICITY_MODE, atomicityMode),
JmhIdeBenchmarkRunner.createProperty(PROP_WRITE_SYNC_MODE, writeSyncMode),
JmhIdeBenchmarkRunner.createProperty(PROP_DATA_NODES, 2),
JmhIdeBenchmarkRunner.createProperty(PROP_CLIENT_MODE, client))
.run();
}
示例7: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException
{
Options opt = new OptionsBuilder()
.include(BeansBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.detectJvmArgs()
.build();
new Runner(opt).run();
}
示例8: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(PreconditionTest.class.getSimpleName())
.addProfiler(GCProfiler.class)
.detectJvmArgs()
.build();
new Runner(opt).run();
}
示例9: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(ParserBenchmark.class.getSimpleName())
.addProfiler(GCProfiler.class)
.addProfiler(FlightRecorderProfiler.class)
.detectJvmArgs()
.build();
new Runner(opt).run();
}
示例10: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(".*" + TDigestBench.class.getSimpleName() + ".*")
.resultFormat(ResultFormatType.CSV)
.result("overall-results.csv")
.addProfiler(GCProfiler.class)
.build();
new Runner(opt).run();
}
示例11: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(".*" + Benchmark.class.getSimpleName() + ".*")
.resultFormat(ResultFormatType.CSV)
.result("results.csv")
.addProfiler(GCProfiler.class)
.addProfiler(StackProfiler.class)
.build();
new Runner(opt).run();
}
示例12: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(".*" + FloatHistogramBench.class.getSimpleName() + ".*")
.resultFormat(ResultFormatType.CSV)
.result("overall-results.csv")
.addProfiler(StackProfiler.class)
.addProfiler(GCProfiler.class)
.build();
new Runner(opt).run();
}
示例13: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
ChainedOptionsBuilder opt = new OptionsBuilder()
.include(BenchmarkStringDictionary.class.getSimpleName())
.addProfiler(GCProfiler.class)
.addProfiler(HotspotMemoryProfiler.class)
.warmupTime(TimeValue.seconds(60))
.warmupIterations(8)
.measurementTime(TimeValue.seconds(60))
.measurementIterations(8)
.forks(5)
;
new Runner(opt.build()).run();
}
示例14: main
import org.openjdk.jmh.profile.GCProfiler; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options options = new OptionsBuilder()
.addProfiler(GCProfiler.class)
.build();
new Runner(options).run();
}