Is there a Java profiler that can be integrated as part of JUnit testing.
For example, I would like to have the condition that if a certain method in the test uses more than X% of the CPU, the test must fail / pass.
Or, if a particular method works for more than X minutes, it should fail.
I looked at YourKit, the JVM monitor, and other suggested tools here, as well
java -Xrunhprof:cpu=samples,file=myprogram.hprof
but all are not intended to be used as part of the test.
I would also be fine with calling the profiler from the test, saving the results (automatically) to csv / txt / any other file, and writing code to extract the information.
An open source / free tool would be better if one exists
source
share