本文整理匯總了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);
}