谷歌卡尺:无法完成基准测试(工人退出而不生成数据)

时间:2014-01-08 19:00:59

标签: java caliper

当我尝试使用Caliper运行基准测试方法时,它会在完成任何测量之前退出。我在调试器中确认Caliper正在执行基准测试方法两次,当它正在进行干运行阶段时。但是当它试图运行实验时,它会在完成任何事情之前退出。

基准测试方法非常简单(虽然它调用了很多其他应用程序代码):

@Benchmark
public int testNewOrder(int reps) {
    OrderRequest newOrder = this.newOrder;
    for (int i = 0; i < reps; i++) {
        router.getWorker().processOrderRequest(USER_CONN_ID, newOrder, System.currentTimeMillis());
        mockFixEngineManager.clear();           
    }
    return 10;
}

使用--verbose运行不会产生任何我能看到的不同输出。整个输出是:

Experiment selection: 
  Instruments:   [allocation, runtime]
  User parameters:   {}
  Virtual machines:  [default]
  Selection type:    Full cartesian product

This selection yields 2 experiments.
Starting experiment 1 of 2: {instrument=allocation, benchmarkMethod=testNewOrder, vm=default, parameters={}}… The worker exited without producing data. It has likely crashed. Run with --verbose to see any worker output.

我在Windows 7上运行,使用JDK 1.7.0_40(如果有所不同)。我通过调试器运行了Caliper代码,我看到它正在退出:

// ExperimentingCaliperRun.java, line 384

     processFuture.addListener(new Runnable() {
        @Override public void run() {
          if (!pipeReaderFuture.isDone()) {
            // the process completed without the pipe ever being written to.  it crashed.
            // TODO(gak): get the output from the worker so we can know why it crashed
            stdout.print("The worker exited without producing data. "
                + "It has likely crashed. Run with --verbose to see any worker output.\n");
            stdout.flush();
            System.exit(1);
          }
        }
      }, MoreExecutors.sameThreadExecutor());

pipeReaderFuture.isDone()返回false。我不知道为什么。没有错误写入stderr。

1 个答案:

答案 0 :(得分:0)

这是Caliper Issue #230。发布失败详细信息后,开发人员能够发布修复程序。要获得此修复程序,您需要从Git repositor y获取最新信息才能获得修复。