Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d0278b0 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Update user perf tests to report only mean.

Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
Change-Id: Ib70123217c54b469844ce65ec52b7e7ed5b5998d
parent 363c238b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -28,7 +28,13 @@ public class BenchmarkResults {
        mResults.add(TimeUnit.NANOSECONDS.toMillis(duration));
    }

    public Bundle getStats() {
    public Bundle getStatsToReport() {
        final Bundle stats = new Bundle();
        stats.putDouble("Mean (ms)", mean());
        return stats;
    }

    public Bundle getStatsToLog() {
        final Bundle stats = new Bundle();
        stats.putDouble("Mean (ms)", mean());
        stats.putDouble("Median (ms)", median());
+5 −3
Original line number Diff line number Diff line
@@ -40,9 +40,11 @@ public class BenchmarkResultsReporter implements TestRule {
            @Override
            public void evaluate() throws Throwable {
                base.evaluate();
                final Bundle stats = mRunner.getStats();
                final String summary = getSummaryString(description.getMethodName(), stats);
                logSummary(description.getTestClass().getSimpleName(), summary, mRunner.getAllDurations());
                final Bundle stats = mRunner.getStatsToReport();
                final String summary = getSummaryString(description.getMethodName(),
                        mRunner.getStatsToLog());
                logSummary(description.getTestClass().getSimpleName(), summary,
                        mRunner.getAllDurations());
                stats.putString(Instrumentation.REPORT_KEY_STREAMRESULT, summary);
                InstrumentationRegistry.getInstrumentation().sendStatus(
                        Activity.RESULT_OK, stats);
+6 −2
Original line number Diff line number Diff line
@@ -93,8 +93,12 @@ public class BenchmarkRunner {
        mState = RUNNING;
    }

    public Bundle getStats() {
        return mResults.getStats();
    public Bundle getStatsToReport() {
        return mResults.getStatsToReport();
    }

    public Bundle getStatsToLog() {
        return mResults.getStatsToLog();
    }

    public ArrayList<Long> getAllDurations() {
+7 −5
Original line number Diff line number Diff line
@@ -49,19 +49,21 @@ import java.util.concurrent.TimeUnit;
 * make MultiUserPerfTests &&
 * adb install -r \
 *     ${ANDROID_PRODUCT_OUT}/data/app/MultiUserPerfTests/MultiUserPerfTests.apk &&
 * adb shell am instrument -e class android.multiuser.UserLifecycleTest \
 * adb shell am instrument -e class android.multiuser.UserLifecycleTests \
 *     -w com.android.perftests.multiuser/android.support.test.runner.AndroidJUnitRunner
 *
 * or
 *
 * bit MultiUserPerfTests:android.multiuser.UserLifecycleTest
 * bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
 *
 * Note: If you use bit for running the tests, benchmark results won't be printed on the host side.
 * But in either case, results can be checked on the device side 'adb logcat -s UserLifecycleTest'
 * But in either case, results can be checked on the device side 'adb logcat -s UserLifecycleTests'
 */
@LargeTest
@RunWith(AndroidJUnit4.class)
public class UserLifecycleTest {
public class UserLifecycleTests {
    private static final String TAG = UserLifecycleTests.class.getSimpleName();

    private final int TIMEOUT_IN_SECOND = 30;
    private final int CHECK_USER_REMOVED_INTERVAL_MS = 200;

@@ -276,7 +278,7 @@ public class UserLifecycleTest {
                            bootCompleteLatch.countDown();
                        }
                    }
                }, "UserLifecycleTest");
                }, TAG);
    }

    private void registerBroadcastReceiver(final String action, final CountDownLatch latch,