private void logTimeTakenByPhase ( GraphContext graphContext , Class < ? extends RulePhase > phase , int timeTaken ) { if ( ! timeTakenByPhase . containsKey ( phase ) ) { RulePhaseExecutionStatisticsModel model = new GraphService <> ( graphContext , RulePhaseExecutionStatisticsModel . class ) . create ( ) ; model . setRulePhase ( phase . toString ( ) ) ; model . setTimeTaken ( timeTaken ) ; model . setOrderExecuted ( timeTakenByPhase . size ( ) ) ; timeTakenByPhase . put ( phase , model . getElement ( ) . id ( ) ) ; } else { GraphService < RulePhaseExecutionStatisticsModel > service = new GraphService <> ( graphContext , RulePhaseExecutionStatisticsModel . class ) ; RulePhaseExecutionStatisticsModel model = service . getById ( timeTakenByPhase . get ( phase ) ) ; int prevTimeTaken = model . getTimeTaken ( ) ; model . setTimeTaken ( prevTimeTaken + timeTaken ) ; } }
Logs the time taken by this rule and adds this to the total time taken for this phase