示例#1
0
  public void testInstallTime() throws Exception {
    final int NUMBER_REPEAT = 10;
    final CtsBuildHelper build = mBuild;
    final ITestDevice device = mDevice;
    double[] result =
        MeasureTime.measure(
            NUMBER_REPEAT,
            new MeasureRun() {
              @Override
              public void prepare(int i) throws Exception {
                device.uninstallPackage(PACKAGE);
              }

              @Override
              public void run(int i) throws Exception {
                File app = build.getTestApp(APK);
                device.installPackage(app, false);
              }
            });
    mReport.printArray("time in ms", result, false);
    StatResult stat = Stat.getStat(result);
    mReport.printSummary("time in ms", stat.mAverage, stat.mStddev);
  }
示例#2
0
 private void doRunMemcpy(int bufferSize) {
   double[] result = new double[REPETITION];
   for (int i = 0; i < REPETITION; i++) {
     result[i] = MemoryNative.runMemcpy(bufferSize, REPEAT_IN_EACH_CALL);
   }
   getReportLog().printArray("ms", result, false);
   double[] mbps =
       ReportLog.calcRatePerSecArray(
           (double) bufferSize * REPEAT_IN_EACH_CALL / 1024.0 / 1024.0, result);
   getReportLog().printArray("MB/s", mbps, true);
   Stat.StatResult stat = Stat.getStat(mbps);
   WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
   Point size = new Point();
   wm.getDefaultDisplay().getSize(size);
   Log.i(TAG, " x " + size.x + " y " + size.y);
   double pixels = size.x * size.y;
   // now this represents how many times the whole screen can be copied in a sec.
   double screensPerSecAverage = stat.mAverage / pixels * 1024.0 * 1024.0 / 4.0;
   double screensPerSecStddev = stat.mStddev / pixels * 1024.0 * 1024.0 / 4.0;
   getReportLog().printSummary("screen copies per sec", screensPerSecAverage, screensPerSecStddev);
 }
示例#3
0
 @Override
 protected void tearDown() throws Exception {
   super.tearDown();
   mDevice.uninstallPackage(PACKAGE);
   mReport.throwReportToHost();
 }