Add option to enable tracing all the launches.
This option is disabled by default. Bug: b/129888684 Test : Ran app launch test case locally. Change-Id: I1305361adf0cb80e2be6a191b8639f7a53e9abfc
This commit is contained in:
@@ -78,6 +78,7 @@ public class AppLaunch extends InstrumentationTestCase {
|
||||
private static final String KEY_SIMPLEPERF_CMD = "simpleperf_cmd";
|
||||
private static final String KEY_SIMPLEPERF_APP = "simpleperf_app";
|
||||
private static final String KEY_CYCLE_CLEAN = "cycle_clean";
|
||||
private static final String KEY_TRACE_ALL = "trace_all";
|
||||
private static final String KEY_TRACE_ITERATIONS = "trace_iterations";
|
||||
private static final String KEY_LAUNCH_DIRECTORY = "launch_directory";
|
||||
private static final String KEY_TRACE_DIRECTORY = "trace_directory";
|
||||
@@ -111,7 +112,7 @@ public class AppLaunch extends InstrumentationTestCase {
|
||||
private static final String SUCCESS_MESSAGE = "Status: ok";
|
||||
private static final String TOTAL_TIME_MESSAGE = "TotalTime:";
|
||||
private static final String COMPILE_SUCCESS = "Success";
|
||||
private static final String LAUNCH_ITERATION = "LAUNCH_ITERATION - %d";
|
||||
private static final String LAUNCH_ITERATION = "LAUNCH_ITERATION-%d";
|
||||
private static final String TRACE_ITERATION = "TRACE_ITERATION-%d";
|
||||
private static final String LAUNCH_ITERATION_PREFIX = "LAUNCH_ITERATION";
|
||||
private static final String TRACE_ITERATION_PREFIX = "TRACE_ITERATION";
|
||||
@@ -142,6 +143,7 @@ public class AppLaunch extends InstrumentationTestCase {
|
||||
private String[] mCompilerFilters = null;
|
||||
private String mLastAppName = "";
|
||||
private boolean mCycleCleanUp = false;
|
||||
private boolean mTraceAll = false;
|
||||
private boolean mIterationCycle = false;
|
||||
private long mCycleTime = 0;
|
||||
private StringBuilder mCycleTimes = new StringBuilder();
|
||||
@@ -296,18 +298,40 @@ public class AppLaunch extends InstrumentationTestCase {
|
||||
// skip if the app has failures while launched first
|
||||
continue;
|
||||
}
|
||||
// In the "applaunch.txt" file app launches are referenced using
|
||||
// "LAUNCH_ITERATION - ITERATION NUM"
|
||||
launchResults = startApp(launch.getApp(), launch.getLaunchReason());
|
||||
if (launchResults.mLaunchTime < 0) {
|
||||
addLaunchResult(launch, new AppLaunchResult());
|
||||
// if it fails once, skip the rest of the launches
|
||||
continue;
|
||||
} else {
|
||||
mCycleTime += launchResults.mLaunchTime;
|
||||
addLaunchResult(launch, launchResults);
|
||||
AtraceLogger atraceLogger = null;
|
||||
if (mTraceAll) {
|
||||
Log.i(TAG, "Started tracing " + launch.getApp());
|
||||
atraceLogger = AtraceLogger
|
||||
.getAtraceLoggerInstance(getInstrumentation());
|
||||
}
|
||||
sleep(POST_LAUNCH_IDLE_TIMEOUT);
|
||||
try {
|
||||
// Start the trace
|
||||
if (atraceLogger != null) {
|
||||
atraceLogger.atraceStart(traceCategoriesSet, traceBufferSize,
|
||||
traceDumpInterval, rootTraceSubDir,
|
||||
String.format("%s-%s-%s", launch.getApp(),
|
||||
launch.getCompilerFilter(), launch.getLaunchReason()));
|
||||
}
|
||||
// In the "applaunch.txt" file app launches are referenced using
|
||||
// "LAUNCH_ITERATION - ITERATION NUM"
|
||||
launchResults = startApp(launch.getApp(), launch.getLaunchReason());
|
||||
if (launchResults.mLaunchTime < 0) {
|
||||
addLaunchResult(launch, new AppLaunchResult());
|
||||
// if it fails once, skip the rest of the launches
|
||||
continue;
|
||||
} else {
|
||||
mCycleTime += launchResults.mLaunchTime;
|
||||
addLaunchResult(launch, launchResults);
|
||||
}
|
||||
sleep(POST_LAUNCH_IDLE_TIMEOUT);
|
||||
} finally {
|
||||
// Stop the trace
|
||||
if (atraceLogger != null) {
|
||||
Log.i(TAG, "Stopped tracing " + launch.getApp());
|
||||
atraceLogger.atraceStop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// App launch times for trace launch will not be used for final
|
||||
@@ -534,6 +558,7 @@ public class AppLaunch extends InstrumentationTestCase {
|
||||
mLaunchOrder = args.getString(KEY_LAUNCH_ORDER, LAUNCH_ORDER_CYCLIC);
|
||||
mSimplePerfAppOnly = Boolean.parseBoolean(args.getString(KEY_SIMPLEPERF_APP));
|
||||
mCycleCleanUp = Boolean.parseBoolean(args.getString(KEY_CYCLE_CLEAN));
|
||||
mTraceAll = Boolean.parseBoolean(args.getString(KEY_TRACE_ALL));
|
||||
mTrialLaunch = mTrialLaunch || Boolean.parseBoolean(args.getString(KEY_TRIAL_LAUNCH));
|
||||
|
||||
if (mSimplePerfCmd != null && mSimplePerfAppOnly) {
|
||||
|
||||
Reference in New Issue
Block a user