public BenchmarkResult run ( ) { final BenchmarkResult res = new BenchmarkResult ( conf . getListener ( ) ) ; BenchmarkExecutor . initialize ( conf , res ) ; // instantiate methods final Map < Class < ? > , Object > instantiatedObjs = instantiateObjects ( res ) ; // getting Benchmarkables try { final List < BenchmarkElement > elements = getBenchmarkElements ( instantiatedObjs ) ; // arranging them final AbstractMethodArrangement arrangement = AbstractMethodArrangement . getMethodArrangement ( elements , conf . getArrangement ( ) ) ; // getting the mapping and executing beforemethod final Map < Class < ? > , Object > objectsToExecute = executeBeforeBenchClass ( instantiatedObjs , res ) ; // executing the bench for the arrangement for ( final BenchmarkElement elem : arrangement ) { // invoking gc if possible if ( RAN . nextDouble ( ) < conf . getGcProb ( ) ) { System . gc ( ) ; } final BenchmarkExecutor exec = BenchmarkExecutor . getExecutor ( elem ) ; final Object obj = objectsToExecute . get ( elem . getMeth ( ) . getMethodToBench ( ) . getDeclaringClass ( ) ) ; // check needed because of failed initialization of objects if ( obj != null ) { exec . executeBeforeMethods ( obj ) ; exec . executeBench ( obj , elem . getParameter ( ) ) ; exec . executeAfterMethods ( obj ) ; } } // cleaning up methods to benchmark tearDownObjectsToExecute ( objectsToExecute , res ) ; } catch ( PerfidixMethodCheckException exc ) { res . addException ( exc ) ; } return res ; }
Running this benchmark