use min app launch time in AppLaunch perf test
Change-Id: Id3a5872ff29fba5daeff058f0842fd011e50a0a1
(cherry picked from commit 2861a89bed)
This commit is contained in:
@@ -90,6 +90,8 @@ public class AppLaunch extends InstrumentationTestCase {
|
|||||||
// simply pass the app if launch isn't successful
|
// simply pass the app if launch isn't successful
|
||||||
// error should have already been logged by startApp
|
// error should have already been logged by startApp
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
mNameToLaunchTime.put(app, launchTime);
|
||||||
}
|
}
|
||||||
sleep(INITIAL_LAUNCH_IDLE_TIMEOUT);
|
sleep(INITIAL_LAUNCH_IDLE_TIMEOUT);
|
||||||
closeApp(app, false);
|
closeApp(app, false);
|
||||||
@@ -98,9 +100,9 @@ public class AppLaunch extends InstrumentationTestCase {
|
|||||||
// do the real app launch now
|
// do the real app launch now
|
||||||
for (int i = 0; i < mLaunchIterations; i++) {
|
for (int i = 0; i < mLaunchIterations; i++) {
|
||||||
for (String app : mNameToResultKey.keySet()) {
|
for (String app : mNameToResultKey.keySet()) {
|
||||||
long totalLaunchTime = mNameToLaunchTime.get(app);
|
long prevLaunchTime = mNameToLaunchTime.get(app);
|
||||||
long launchTime = 0;
|
long launchTime = 0;
|
||||||
if (totalLaunchTime < 0) {
|
if (prevLaunchTime < 0) {
|
||||||
// skip if the app has previous failures
|
// skip if the app has previous failures
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -110,18 +112,19 @@ public class AppLaunch extends InstrumentationTestCase {
|
|||||||
mNameToLaunchTime.put(app, -1L);
|
mNameToLaunchTime.put(app, -1L);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
totalLaunchTime += launchTime;
|
// keep the min launch time
|
||||||
mNameToLaunchTime.put(app, totalLaunchTime);
|
if (launchTime < prevLaunchTime) {
|
||||||
|
mNameToLaunchTime.put(app, launchTime);
|
||||||
|
}
|
||||||
sleep(POST_LAUNCH_IDLE_TIMEOUT);
|
sleep(POST_LAUNCH_IDLE_TIMEOUT);
|
||||||
closeApp(app, true);
|
closeApp(app, true);
|
||||||
sleep(BETWEEN_LAUNCH_SLEEP_TIMEOUT);
|
sleep(BETWEEN_LAUNCH_SLEEP_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String app : mNameToResultKey.keySet()) {
|
for (String app : mNameToResultKey.keySet()) {
|
||||||
long totalLaunchTime = mNameToLaunchTime.get(app);
|
long launchTime = mNameToLaunchTime.get(app);
|
||||||
if (totalLaunchTime != -1) {
|
if (launchTime != -1) {
|
||||||
mResult.putDouble(mNameToResultKey.get(app),
|
mResult.putLong(mNameToResultKey.get(app), launchTime);
|
||||||
((double) totalLaunchTime) / mLaunchIterations);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instrumentation.sendStatus(0, mResult);
|
instrumentation.sendStatus(0, mResult);
|
||||||
|
|||||||
Reference in New Issue
Block a user