public static void moniterTest(Context context,int interval,int testTime){
  long startTime=System.currentTimeMillis();
  while ((System.currentTimeMillis() - startTime) < testTime) {
    String memoryUsageString=getMyTracksPssMemoryInfo(context);
    String batteryUsageString=getBatteryUsageInfo(context);
    String oneInfo=String.format("{%s: memory use %s, battery left %s. \r\n",String.format("{%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS",new Date()),memoryUsageString,batteryUsageString);
    writeToFile(oneInfo,true);
    Log.d(TAG,oneInfo);
    EndToEndTestUtils.sleep(interval);
  }
}

public static void moniterTest ( Context context , int interval , int testTime ) { long startTime = System . currentTimeMillis ( ) ; while ( ( System . currentTimeMillis ( ) - startTime ) < testTime ) { String memoryUsageString = getMyTracksPssMemoryInfo ( context ) ; String batteryUsageString = getBatteryUsageInfo ( context ) ; String oneInfo = String . format ( "{%s: memory use %s, battery left %s. \r\n" , String . format ( "{%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS" , new Date ( ) ) , memoryUsageString , batteryUsageString ) ; writeToFile ( oneInfo , true ) ; Log . d ( TAG , oneInfo ) ; EndToEndTestUtils . sleep ( interval ) ; } }
monitors the battery and memory usage during test , and writes the usage info to a local file .
