J’ai un étalon de référence (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(Ssortingng[] args) { CaliperMain.main(MyBenchmark.class, args); } }
Je le lance à partir de Eclipse ou de la ligne de commande avec:
mvn exec:java -Dexec.mainClass="com.google.caliper.runner.CaliperMain" -Dexec.args="MyBenchmark"
dans les deux cas, j’ai eu une erreur:
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/sortingal-1.log to see any worker output.
dans ce fichier, je vois:
Trial Number: 1 Trial Id: d663a0b5-55b4-43c3-97d8-93f14f436342 Experiment: {instrument=allocation, benchmarkMethod=a, vm=default, parameters={}} [stderr] CIComstackrCount 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)
Des idées comment résoudre ce problème?
j’ai trouvé une solution. flag -XX:-TieredCompilation
aide. il peut être utilisé directement dans la classe java microbenchmark en tant que:
import com.google.caliper.api.VmOptions; @VmOptions("-XX:-TieredCompilation") public class MyMicrobenchmark { ...
C’est un bug dans Caliper. Il utilise -XX:CIComstackrCount=1
comme argument JVM par défaut. Cependant, lorsque la compilation hiérarchisée est activée, il doit y avoir au moins 2 unités d’exécution du compilateur (une pour C1 et une pour C2).
Essayez de -XX:CIComstackrCount
manuellement -XX:CIComstackrCount
avec une valeur plus grande.