public static void collectApplicationServletStats(Context context,Application app){
  int svltCount=0;
  int reqCount=0;
  int errCount=0;
  long procTime=0;
  long minTime=Long.MAX_VALUE;
  long maxTime=0;
  for (  Container container : context.findChildren()) {
    if (container instanceof StandardWrapper) {
      StandardWrapper sw=(StandardWrapper)container;
      svltCount++;
      reqCount+=sw.getRequestCount();
      errCount+=sw.getErrorCount();
      procTime+=sw.getProcessingTime();
      if (sw.getRequestCount() > 0) {
        minTime=Math.min(minTime,sw.getMinTime());
      }
      maxTime=Math.max(maxTime,sw.getMaxTime());
    }
  }
  app.setServletCount(svltCount);
  app.setRequestCount(reqCount);
  app.setErrorCount(errCount);
  app.setProcessingTime(procTime);
  app.setMinTime(minTime == Long.MAX_VALUE ? 0 : minTime);
  app.setMaxTime(maxTime);
}

public static void collectApplicationServletStats ( Context context , Application app ) { int svltCount = 0 ; int reqCount = 0 ; int errCount = 0 ; long procTime = 0 ; long minTime = Long . MAX_VALUE ; long maxTime = 0 ; for ( Container container : context . findChildren ( ) ) { if ( container instanceof StandardWrapper ) { StandardWrapper sw = ( StandardWrapper ) container ; svltCount ++ ; reqCount += sw . getRequestCount ( ) ; errCount += sw . getErrorCount ( ) ; procTime += sw . getProcessingTime ( ) ; if ( sw . getRequestCount ( ) > 0 ) { minTime = Math . min ( minTime , sw . getMinTime ( ) ) ; } maxTime = Math . max ( maxTime , sw . getMaxTime ( ) ) ; } } app . setServletCount ( svltCount ) ; app . setRequestCount ( reqCount ) ; app . setErrorCount ( errCount ) ; app . setProcessingTime ( procTime ) ; app . setMinTime ( minTime == Long . MAX_VALUE ? 0 : minTime ) ; app . setMaxTime ( maxTime ) ; }
calculates sum of requestcount , errorcount and processingtime for all servlets for the given application . it also works out minimum value of mintime and maximum value for maxtime for all servlets .
