Caliper:如何在线发布结果?
我目前正在尝试使用 google code 项目的 wiki 上提供的一些文档来解决 Caliper 问题。成功运行了一些基准测试后,我现在想将结果发布到网上,以便我可以比在命令行上更清楚地阅读它们。
我按照 wiki 上的说明进行操作,访问 microbenchmarks.appspot.com 网站并将 API 密钥复制到我的“.caliperrc”文件中。顺便说一句,这个网页告诉我“.caliperrc”文件应该是“在 Windows 上:C:\.caliperrc”,但事实上,Caliper 在 Windows 上的 %HOME%\.caliperrc 中搜索(至少对于七):c:\users\%login%\.caliperrc。
这样,Caliper 确实尝试上传结果...但失败并显示消息“Posting to http: //microbenchmarks.appspot.com:80/run/ 失败:内部服务器错误”。当我更改 Runner.run 方法的代码以便它也打印 RuntimeException 的堆栈跟踪时,它显示如下所示(%APIKey% 在我的 .caliperrc 文件中有“APIKey”的字符串):
java.lang.RuntimeException: Posting to http://microbenchmarks.appspot.com:80/run/ failed.
at com.google.caliper.Runner.postResults(Runner.java:206)
at com.google.caliper.Runner.run(Runner.java:96)
at com.google.caliper.Runner.main(Runner.java:405)
at com.google.caliper.Runner.main(Runner.java:417)
at collections.ArrayListBenchmark.main(ArrayListBenchmark.java:119)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://microbenchmarks.appspot.com:80/run/%APIKey%/collections.ArrayListBenchmark
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.google.caliper.Runner.postResults(Runner.java:200)
... 4 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://microbenchmarks.appspot.com:80/run/%APIKey%/collections.ArrayListBenchmark
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at com.google.caliper.Runner.postResults(Runner.java:188)
... 4 more
我是否缺少我应该遵循的步骤?如果重要的话,我在 Windows 7 64 位上使用以下 Java 版本直接从 svn 运行 Caliper 源代码:
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
I am currently trying to get my way around Caliper with the few documentation available on the google code project's wiki. Having managed to run a few benchmarks, I would now like to post the results online so that I can read them a little more clearly than on the command line.
I followed the instructions on the wiki, went to the microbenchmarks.appspot.com website and copied the API key in my ".caliperrc" file. As a side note, this web page tells me that the ".caliperrc" file should be "on Windows: C:\.caliperrc" but in fact, Caliper searches in %HOME%\.caliperrc which is on windows (at least for seven) : c:\users\%login%\.caliperrc.
With this, Caliper indeed tries to upload the results... but it fails with the message "Posting to http://microbenchmarks.appspot.com:80/run/ failed: Internal Server Error". When I alter the code of the Runner.run method so that it also prints the RuntimeException's stack trace, it appears as shown below (%APIKey% in there is the String for 'APIKey' in my .caliperrc file) :
java.lang.RuntimeException: Posting to http://microbenchmarks.appspot.com:80/run/ failed.
at com.google.caliper.Runner.postResults(Runner.java:206)
at com.google.caliper.Runner.run(Runner.java:96)
at com.google.caliper.Runner.main(Runner.java:405)
at com.google.caliper.Runner.main(Runner.java:417)
at collections.ArrayListBenchmark.main(ArrayListBenchmark.java:119)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://microbenchmarks.appspot.com:80/run/%APIKey%/collections.ArrayListBenchmark
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.google.caliper.Runner.postResults(Runner.java:200)
... 4 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://microbenchmarks.appspot.com:80/run/%APIKey%/collections.ArrayListBenchmark
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at com.google.caliper.Runner.postResults(Runner.java:188)
... 4 more
Am I missing a step I should have followed? If it matters, I am on windows seven 64 bits running the Caliper source code directly from svn using the following Java version :
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已将此问题报告为 Caliper bug 113。作为解决此问题之前的(蹩脚)解决方法,您应该在美国语言环境中运行 JVM。在您的 main 方法中,调用
Locale.setDefault(Locale.US)
。I've reported this as Caliper bug 113. As a (lame) workaround until this is fixed, you should run your JVM in a US locale. In your main method, call
Locale.setDefault(Locale.US)
.