Update user perf tests to report only mean.

Test: bit MultiUserPerfTests:android.multiuser.UserLifecycleTests
Change-Id: Ib70123217c54b469844ce65ec52b7e7ed5b5998d
This commit is contained in:
Sudheer Shanka
2017-07-12 18:12:31 -07:00
parent 363c238b5e
commit 2d0278b09f
4 changed files with 25 additions and 11 deletions

View File

@@ -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());

View File

@@ -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);

View File

@@ -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() {

View File

@@ -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,