本文整理汇总了Java中org.openjdk.jmh.results.format.ResultFormat类的典型用法代码示例。如果您正苦于以下问题:Java ResultFormat类的具体用法?Java ResultFormat怎么用?Java ResultFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResultFormat类属于org.openjdk.jmh.results.format包,在下文中一共展示了ResultFormat类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.openjdk.jmh.results.format.ResultFormat; //导入依赖的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();
}
示例2: getResultFormater
import org.openjdk.jmh.results.format.ResultFormat; //导入依赖的package包/类
private static ResultFormat getResultFormater(final File outputFile) {
return new ResultFormat() {
@Override
public void writeOut(Collection<RunResult> results) {
try {
PrintStream pw = new PrintStream(outputFile, "UTF-8");
ResultFormat rf = new H2OResultFormat(pw, ",", H2O_UBENCH_GIT_SHA, H2O_UBENCH_DATE);
rf.writeOut(results);
pw.flush();
pw.close();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
};
}
示例3: printResult
import org.openjdk.jmh.results.format.ResultFormat; //导入依赖的package包/类
private static void printResult(Collection<RunResult> runResults) {
System.out.println();
ResultFormat resultFormat = ResultFormatFactory.getInstance(ResultFormatType.TEXT, System.out);
resultFormat.writeOut(runResults);
}