本文整理汇总了Java中org.openjdk.jmh.results.format.ResultFormatType类的典型用法代码示例。如果您正苦于以下问题:Java ResultFormatType类的具体用法?Java ResultFormatType怎么用?Java ResultFormatType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultFormatType类属于org.openjdk.jmh.results.format包,在下文中一共展示了ResultFormatType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException, CommandLineOptionException {
Package currentPackage = Package.getPackage( "org.apache.bval.bench" );
System.out.println( currentPackage.getImplementationTitle() + " - " + currentPackage.getImplementationVersion() );
Options commandLineOptions = new CommandLineOptions( args );
ChainedOptionsBuilder builder = new OptionsBuilder().parent( commandLineOptions );
if ( !commandLineOptions.getResult().hasValue() ) {
builder.result( "target/jmh-results.json" );
}
if ( !commandLineOptions.getResultFormat().hasValue() ) {
builder.resultFormat( ResultFormatType.JSON );
}
if ( commandLineOptions.getIncludes().isEmpty() ) {
DEFAULT_TEST_CLASSES.forEach( testClass -> builder.include( testClass.getName() ) );
}
Options opt = builder.build();
new Runner( opt ).run();
}
示例2: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
for (int threads = 1; threads < 32; threads <<= 1) {
Options opt = new OptionsBuilder()
.forks(10)
.threads(threads)
.warmupIterations(10)
.measurementIterations(20)
.mode(Mode.AverageTime)
.timeUnit(TimeUnit.NANOSECONDS)
.include("ky.korins.atomic.benchmark")
.resultFormat(ResultFormatType.CSV)
.result("atomic_" + threads + ".csv")
.build();
new Runner(opt).run();
}
}
示例3: launchBenchmark
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
@Test
public void launchBenchmark() throws RunnerException {
String targetFolder = Paths.get(
this.getClass().getResource("/").getFile()).getParent().toString();
Options opt = new OptionsBuilder()
.include(".*Benchmark")
.warmupTime(TimeValue.seconds(1))
.warmupIterations(5)
.measurementTime(TimeValue.seconds(1))
.measurementIterations(10)
.threads(1)
.forks(1)
.shouldFailOnError(true)
.shouldDoGC(true)
.jvmArgs("-server")
.resultFormat(ResultFormatType.JSON)
.result(targetFolder+"/"+FrenchPhoneticBenchmark.class.getName() + ".jmh.json")
.build();
new Runner(opt).run();
}
示例4: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException, IOException {
final String include;
if (args.length == 0) {
include = askRunAll();
} else {
include = args[0];
}
final Options opt = new OptionsBuilder()//
.include(include)//
.mode(Mode.Throughput)//
.measurementIterations(3)//
.measurementBatchSize(1)//
.measurementTime(TimeValue.milliseconds(1000))//
.forks(1)//
.timeUnit(TimeUnit.MICROSECONDS)//
.warmupIterations(3)//
.warmupTime(TimeValue.milliseconds(1000))//
.build();
final Collection<RunResult> runResult = new Runner(opt).run();
System.out.flush();
final ResultFormat resultFormat = ResultFormatFactory.getInstance(ResultFormatType.CSV, System.out);
resultFormat.writeOut(runResult);
System.out.flush();
}
示例5: runJMH
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
private static void runJMH(final String parserClasss, final int forks, final int threads, final int warmupit, final int measureit) throws Exception {
final Options opt = new OptionsBuilder()
.include(REGEX)
.forks(forks)
.warmupIterations(warmupit)
.measurementIterations(measureit)
.threads(threads)
.mode(Mode.Throughput)
.timeUnit(TimeUnit.SECONDS)
.verbosity(VerboseMode.EXTRA)
.jvmArgs("-Xmx" + MEMORY, "-Dfile.encoding=utf-8", "-Dbenchmark.impl="+parserClasss)
.resultFormat(ResultFormatType.JSON)
.result(String.format("jmh_benchmark_thrpt_result_%s_f%d_t%d_w%d_i%d_t%s.txt", parserClasss, forks, threads, warmupit, measureit,
TSS))
.output(String.format("jmh_benchmark_thrpt_log_%s_f%d_t%d_w%d_i%d_t%s.txt", parserClasss, forks, threads, warmupit, measureit, TSS))
//.addProfiler(GCProfiler.class) // report GC time
//.addProfiler(StackProfiler.class) // report method stack execution profile
.build();
new Runner(opt).run();
}
示例6: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的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();
}
}
示例7: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(FineGrainedLockBenchmark.class.getSimpleName())
.resultFormat(ResultFormatType.CSV)
.build();
new Runner(opt).run();
}
示例8: run
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
@Test
public void run() throws Exception {
final String className = getClass().getSimpleName();
final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
.include(".*" + className + ".*")
.jvmArgs(JVM_ARGS);
if (getWarmupIterations() > 0) {
runnerOptions.warmupIterations(getWarmupIterations());
}
if (getMeasureIterations() > 0) {
runnerOptions.measurementIterations(getMeasureIterations());
}
if (getForks() > 0) {
runnerOptions.forks(getForks());
}
if (getReportDir() != null) {
final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
final File file = new File(filePath);
if (file.exists()) {
file.delete();
} else {
file.getParentFile().mkdirs();
file.createNewFile();
}
runnerOptions.resultFormat(ResultFormatType.JSON);
runnerOptions.result(filePath);
}
new Runner(runnerOptions.build()).run();
}
示例9: run
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
@Test
public void run() throws Exception {
String className = getClass().getSimpleName();
ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
.include(".*" + className + ".*")
.jvmArgs(JVM_ARGS);
if (getWarmupIterations() > 0) {
runnerOptions.warmupIterations(getWarmupIterations());
}
if (getMeasureIterations() > 0) {
runnerOptions.measurementIterations(getMeasureIterations());
}
if (getForks() > 0) {
runnerOptions.forks(getForks());
}
if (getReportDir() != null) {
String filePath = getReportDir() + className + ".json";
File file = new File(filePath);
if (file.exists()) {
file.delete();
} else {
file.getParentFile().mkdirs();
file.createNewFile();
}
runnerOptions.resultFormat(ResultFormatType.JSON);
runnerOptions.result(filePath);
}
new Runner(runnerOptions.build()).run();
}
示例10: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String[] args) throws RunnerException {
System.out.println(JmhMapBenchmarks.class.getSimpleName());
Options opt = new OptionsBuilder()
.include(
".*" + JmhMapBenchmarks.class.getSimpleName()
+ ".(timeInsert)")
.timeUnit(TimeUnit.NANOSECONDS)
.forks(0)
//.warmupMode(WarmupMode.INDI)
.warmupIterations(0)
.warmupTime(TimeValue.seconds(1))
.mode(Mode.AverageTime)
.measurementIterations(5)
.param("dataType", "MAP")
.param("run", "0")
// .param("run", "1")
// .param("run", "2")
// .param("run", "3")
//.addProfiler(CountingIntegerProfiler.class)
//.param("producer", "SLEEPING_INTEGER")
.param("producer", "COUNTING_INTEGER")
.param("sampleDataSelection", "MATCH").param("size", "1024") // 1048576
//.param("valueFactoryFactory", "VF_PDB_PERSISTENT_SPECIALIZED")
.param("valueFactoryFactory", "VF_PDB_PERSISTENT_CURRENT")
//.param("valueFactoryFactory", "VF_SCALA")
//.param("valueFactoryFactory", "VF_CLOJURE")
.resultFormat(ResultFormatType.CSV)
.result("latest-results-main.csv")
.build();
new Runner(opt).run();
}
示例11: main
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public static void main(String... args) throws Exception {
Options opts = new OptionsBuilder()
.include(".*")
.warmupIterations(10)
.measurementIterations(10)
.forks(3)
.jvmArgs("-server")
.resultFormat(ResultFormatType.TEXT)
.build();
new Runner(opts).run();
}
示例12: run
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
@Test
public void run() throws Exception {
final String className = getClass().getSimpleName();
final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
.include(".*" + className + ".*")
.jvmArgs(getJvmArgs());
if (getWarmupIterations() > 0) {
runnerOptions.warmupIterations(getWarmupIterations());
}
if (getMeasureIterations() > 0) {
runnerOptions.measurementIterations(getMeasureIterations());
}
if (getForks() > 0) {
runnerOptions.forks(getForks());
}
if (getReportDir() != null) {
final String dtmStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
final String filePath = getReportDir() + className + "-" + dtmStr + ".json";
final File file = new File(filePath);
if (file.exists()) {
file.delete();
} else {
file.getParentFile().mkdirs();
file.createNewFile();
}
runnerOptions.resultFormat(ResultFormatType.JSON);
runnerOptions.result(filePath);
}
new Runner(runnerOptions.build()).run();
}
示例13: tiffTest
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public void tiffTest() throws RunnerException {
Options opt = new OptionsBuilder()
.include(WriteMediumFileTest.class.getSimpleName()).forks(1)
.result("resultsMedium.txt").resultFormat(ResultFormatType.TEXT)
.build();
new Runner(opt).run();
}
示例14: tiffTest
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
public void tiffTest() throws RunnerException {
Options opt = new OptionsBuilder()
.include(WriteSmallFileTest.class.getSimpleName()).forks(1)
.result("results-small.txt").resultFormat(ResultFormatType.TEXT)
.build();
new Runner(opt).run();
}
示例15: tiffTest
import org.openjdk.jmh.results.format.ResultFormatType; //导入依赖的package包/类
@Test
public void tiffTest() throws RunnerException {
Options opt = new OptionsBuilder()
.include(WriteLargeFileTest.class.getSimpleName()).forks(1)
.result("resultsLarge.txt").resultFormat(ResultFormatType.TEXT)
.addProfiler(StackProfiler.class).build();
new Runner(opt).run();
}