tôi có một chuẩn mực caliper (1.0-beta-2):lỗi caliper: CICompilerCount of 1 không hợp lệ; phải có ít nhất 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);
}
}
i chạy nó từ nhật thực hoặc từ dòng lệnh với:
mvn exec:java -Dexec.mainClass="com.google.caliper.runner.CaliperMain" -Dexec.args="MyBenchmark"
trong cả hai trường hợp tôi đã nhận một lỗi:
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.
trong tập tin này tôi thấy:
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)
bất kỳ ý tưởng làm thế nào để sửa chữa nó?
Đây không phải là tốt vì nó làm thay đổi đáng kể hành vi mặc định của JVM, và nó phá vỡ ý tưởng chính của điểm chuẩn: không có sence trong việc đo lường một điều nếu bạn chạy điều khác nhau trong sản xuất. – apangin
Cá nhân tôi khuyên bạn nên sử dụng [JMH] (http://openjdk.java.net/projects/code-tools/jmh/) thay vì Caliper. Công cụ này được phát triển và sử dụng bởi các kỹ sư JVM. – apangin
trông thú vị, cảm ơn bạn! – piotrek