我目前正尝试使用Google代码项目Wiki上提供的一些文档来解决Caliper问题。在设法运行了一些基准测试之后,我现在想将结果在线发布,以便比在命令行上更清晰地阅读它们。

我按照Wiki上的说明进行操作,转到microbenchmarks.appspot.com网站,并将API密钥复制到了我的“.caliperrc”文件中。附带说明一下,该网页告诉我,“。caliperrc”文件应为“在Windows上:C:\。caliperrc”,但实际上,Caliper会在Windows上的%HOME%\。caliperrc中进行搜索(至少对于七):c:\ users \%login%\。caliperrc。

这样,Caliper确实尝试上载结果...但是它失败,并显示消息“发布到http://microbenchmarks.appspot.com:80/run/失败:内部服务器错误”。当我更改Runner.run方法的代码以使其也打印RuntimeException的堆栈跟踪时,它显示如下(在我的.caliperrc文件中,%APIKey%中有'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上使用以下Java版本直接从svn运行Caliper源代码的7个64位Windows上:
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)

最佳答案

我已经将此报告为Caliper bug 113。在解决此问题之前,作为(解决方案)解决方法,您应该在美国语言环境中运行JVM。在您的main方法中,调用Locale.setDefault(Locale.US)

07-27 13:19