Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Update user perf tests to report only mean.
Browse files Browse the repository at this point in the history
Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
Change-Id: Ib70123217c54b469844ce65ec52b7e7ed5b5998d
  • Loading branch information
Sudheer Shanka committed Jul 13, 2017
1 parent 363c238 commit 2d0278b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public void addDuration(long duration) {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ public Statement apply(final Statement base, final Description description) {
@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ public void resumeTiming() {
mState = RUNNING;
}

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

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

public ArrayList<Long> getAllDurations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,21 @@
* 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;

Expand Down Expand Up @@ -276,7 +278,7 @@ public void onLockedBootComplete(int newUserId) {
bootCompleteLatch.countDown();
}
}
}, "UserLifecycleTest");
}, TAG);
}

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

0 comments on commit 2d0278b

Please sign in to comment.