使用JMH时输出奇怪 [英] Strange output when using JMH

查看:128
本文介绍了使用JMH时输出奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jmh对一个简单的应用程序进行基准测试(来自SO问题

I'm using jmh to benchmark a simple application (from SO question Unexpected Scalability results in java fork-join) using maven and following the command-line approach as advised in http://openjdk.java.net/projects/code-tools/jmh/. After successfully setting up and building the benchmark, I get the following benchmark results using the avgt mode:

C:\Users\username\my-app\test>java -jar target/benchmarks.jar -bm avgt -f 1
# JMH 1.10.1 (released 13 days ago)
# VM invoker: C:\Program Files\Java\jre1.8.0_45\bin\java.exe
# VM options: <none>
# Warmup: 20 iterations, 1 s each
# Measurement: 20 iterations, 1 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: org.sample.MyBenchmark.testMethod

# Run progress: 0,00% complete, ETA 00:00:40
# Fork: 1 of 1
# Warmup Iteration   1: ? 10?? s/op
# Warmup Iteration   2: ? 10?? s/op
# Warmup Iteration   3: ? 10?? s/op
# Warmup Iteration   4: ? 10?? s/op
# Warmup Iteration   5: ? 10?? s/op
# Warmup Iteration   6: ? 10?? s/op
# Warmup Iteration   7: ? 10?? s/op
# Warmup Iteration   8: ? 10?? s/op
# Warmup Iteration   9: ? 10?? s/op
# Warmup Iteration  10: ? 10?? s/op
# Warmup Iteration  11: ? 10?? s/op
# Warmup Iteration  12: ? 10?? s/op
# Warmup Iteration  13: ? 10?? s/op
# Warmup Iteration  14: ? 10?? s/op
# Warmup Iteration  15: ? 10?¹? s/op
# Warmup Iteration  16: ? 10?? s/op
# Warmup Iteration  17: ? 10?¹? s/op
# Warmup Iteration  18: ? 10?? s/op
# Warmup Iteration  19: ? 10?¹? s/op
# Warmup Iteration  20: ? 10?¹? s/op
Iteration   1: ? 10?¹? s/op
Iteration   2: ? 10?¹? s/op
Iteration   3: ? 10?? s/op
Iteration   4: ? 10?¹? s/op
Iteration   5: ? 10?¹? s/op
Iteration   6: ? 10?? s/op
Iteration   7: ? 10?¹? s/op
Iteration   8: ? 10?? s/op
Iteration   9: ? 10?? s/op
Iteration  10: ? 10?¹? s/op
Iteration  11: ? 10?? s/op
Iteration  12: ? 10?? s/op
Iteration  13: ? 10?¹? s/op
Iteration  14: ? 10?? s/op
Iteration  15: ? 10?? s/op
Iteration  16: ? 10?¹? s/op
Iteration  17: ? 10?? s/op
Iteration  18: ? 10?¹? s/op
Iteration  19: ? 10?¹? s/op
Iteration  20: ? 10?¹? s/op


Result "testMethod":
? 10?¹? s/op


# Run complete. Total time: 00:00:40

Benchmark               Mode  Cnt    Score     Error  Units
MyBenchmark.testMethod  avgt   20  ? 10?¹?             s/op

我不确定如何解释此输出,但是我确定某些地方出了错...?知道什么或如何调试它吗?

I'm not sure how to interpret this output, but I'm quite sure something went wrong...? Any idea what or how to debug this?

推荐答案

JMH输出使用扩展的Unicode字符.特别是, ? 10 ?? s/op"的意思可能是≈10×10 s/op".请使用正确支持Unicode的终端,请参见

JMH output makes use of extended Unicode characters. In particular, ? 10?? s/op" probably means "≈ 10⁻¹⁰ s/op". Use a terminal that supports Unicode properly, see this.

除了Unicode麻烦之外,您的基准测试似乎太短了,因此JMH提出了一个数量级的估计值,而不是显示"0.000 s/op".

Apart from Unicode troubles, your benchmark seems to be too short, and so JMH presents an order of magnitude estimate instead of showing "0.000 s/op".

这篇关于使用JMH时输出奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆