I'd like to have a java application, which runs the different benchmarks of the Scalabench. I'd like to ensure that the JVM is warmed up before I start to measure how long the benchmark runs. How should I run these benchmarks from my java app?
The first thing which came to my mind is to execute the Scalabench's jar inside a for loop using
Process proc = Runtime.getRuntime().exec("java -jar scalabench.jar testname");
But I don't think if it helps the JVM to warm up, because I think the JVM will load the jar in every iteration of the for loop.
The next possibility is to add the scalabench.jar
as a dependency to my project, and call its main()
method in the for loop to run the test. I think that in this case warming up the JVM should not be a problem, because it runs inside my application and it won't be killed after each iteration.
Bonus: can I use JMH to measure the tests from the Scalabench?