ConcurrentTest
version - 0.9.0
- A java concurrent test library. It provides some base class which can simplify perfermance test for concurrent and multi-core program.
Write code easily, and detailed report is generated automatically.
see doc/userguide.htm for design graph and tutorial.
Demo: Java Relection Performance Test
(see org.bamboo.concurrenttest.demo.MethodInvokeTest for detailed)
Here is a sample to test java reflection under multi-core,multi thread senario.
1) Write code you want to test.
2) Use ConcurrentTestMeter class to run your test.
3) Write main() method.
4) Performance Test Report.
public static void testJavaReflect(int poolSize,int threads ,int runTimes) {
ConcurrentTestMeter concurrentTestMeter = ConcurrentTestMeter.createMeter( poolSize, new RunnerFactory() {
public Runner newRunner() {
return new JavaReflectRunner();
}
public String getTestName() {
return "JavaReflectRunner";
}
});
ConcurrentTestReport report = concurrentTestMeter.runTest( threads,runTimes);
System.out.printf("%s \r\n" ,report.toCsvFormat());
}
Test report as CSV format below:
Type,threadPoolSize ,Concurrency(threads),countPerThread, totalTime(ns),avgTime(ns),TPS:(times/s)
DirectMethodInvokeRunner,4,200,10000,863529862,431,2316
JavaReflectRunner,4,200,10000,1124753844,562,1778
CglibReflectRunner,4,200,10000,918106911,459,2178