private void logTimeTakenByRuleProvider ( GraphContext graphContext , Context context , int ruleIndex , int timeTaken ) { AbstractRuleProvider ruleProvider = ( AbstractRuleProvider ) context . get ( RuleMetadataType . RULE_PROVIDER ) ; if ( ruleProvider == null ) return ; if ( ! timeTakenByProvider . containsKey ( ruleProvider ) ) { RuleProviderExecutionStatisticsModel model = new RuleProviderExecutionStatisticsService ( graphContext ) . create ( ) ; model . setRuleIndex ( ruleIndex ) ; model . setRuleProviderID ( ruleProvider . getMetadata ( ) . getID ( ) ) ; model . setTimeTaken ( timeTaken ) ; timeTakenByProvider . put ( ruleProvider , model . getElement ( ) . id ( ) ) ; } else { RuleProviderExecutionStatisticsService service = new RuleProviderExecutionStatisticsService ( graphContext ) ; RuleProviderExecutionStatisticsModel model = service . getById ( timeTakenByProvider . get ( ruleProvider ) ) ; int prevTimeTaken = model . getTimeTaken ( ) ; model . setTimeTaken ( prevTimeTaken + timeTaken ) ; } logTimeTakenByPhase ( graphContext , ruleProvider . getMetadata ( ) . getPhase ( ) , timeTaken ) ; }
Logs the time taken by this rule and attaches this to the total for the RuleProvider