java - 卡尺错误 : CICompilerCount of 1 is invalid; must be at least 2

标签 java jvm jvm-arguments jvm-crash caliper

我有一个卡尺基准 (1.0-beta-2):

import com.google.caliper.Benchmark;
import com.google.caliper.runner.CaliperMain;

public class MyBenchmark {

    @Benchmark public int a(int rep) {
        return 0;
    }

    public static void main(String[] args) {
        CaliperMain.main(MyBenchmark.class, args);
    }   
}

我从 eclipse 或命令行运行它:

mvn exec:java -Dexec.mainClass="com.google.caliper.runner.CaliperMain" -Dexec.args="MyBenchmark" 

在这两种情况下我都得到了一个错误:

ERROR: Trial failed to complete (its results will not be included in the run):
  The worker exited without producing data. It has likely crashed. Inspect /tmp/1427055470061-0/trial-1.log to see any worker output.

在这个文件中我看到:

Trial Number: 1
Trial Id: d663a0b5-55b4-43c3-97d8-93f14f436342
Experiment: {instrument=allocation, benchmarkMethod=a, vm=default, parameters={}}

[stderr] CICompilerCount of 1 is invalid; must be at least 2
[stderr] Error: Could not create the Java Virtual Machine.
[stderr] Error: A fatal exception has occurred. Program will exit.

ubuntu 14.04,java:

java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

有什么解决办法吗?

最佳答案

我找到了解决办法。标记 -XX:-TieredCompilation 有帮助。它可以直接在 microbenchmark java 类中使用:

import com.google.caliper.api.VmOptions;

@VmOptions("-XX:-TieredCompilation")
public class MyMicrobenchmark {
...

关于java - 卡尺错误 : CICompilerCount of 1 is invalid; must be at least 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29199509/

相关文章:

java - 使用嵌套列表时出现 IndexOutOfBoundsException

java - 如何确定正在运行的 JVM 上的 MaxDirectMemorySize?

java - SpreadsheetAddRows 在中等大小的查询上失败

jvm-arguments - 是相同的意思 "JAVA_ARGS"和 "JAVA OPTS"

oracle - 如何将 Oracle JVM 参数添加到 Tomcat 执行

java - Maven clean install 在 intellij 中工作,但在终端中不起作用

java - 从 Java 应用程序中执行 Pig

java - 从 Java 中的文本中删除链接?

java - 终身代垃圾收集

grails - 在 Grails 2.3.1 中执行 "run-app"时如何将 Java 系统属性传递给 JVM