Add ART optimization dimension to reportFullyDrawn

Bug: 170310046
Test: adb shell cmd stats print-logs
      adb logcat | grep statsd | grep "(50)"
Change-Id: I1d33ff4639c85d2b1f57f2fef72d883c3eed7f00
This commit is contained in:
Riddle Hsu
2020-10-08 20:09:45 +08:00
parent 2bfca13845
commit ec2e3ee704
2 changed files with 20 additions and 9 deletions

View File

@@ -3831,6 +3831,12 @@ message AppStartFullyDrawn {
// App startup time (until call to Activity#reportFullyDrawn()). // App startup time (until call to Activity#reportFullyDrawn()).
optional int64 app_startup_time_millis = 6; optional int64 app_startup_time_millis = 6;
// The compiler filter used when when the package was optimized.
optional int32 package_optimization_compilation_filter = 7;
// The reason why the package was optimized.
optional int32 package_optimization_compilation_reason = 8;
enum SourceType { enum SourceType {
UNAVAILABLE = 0; UNAVAILABLE = 0;
LAUNCHER = 1; LAUNCHER = 1;
@@ -3838,11 +3844,11 @@ message AppStartFullyDrawn {
LOCKSCREEN = 3; LOCKSCREEN = 3;
} }
// The type of the startup source. // The type of the startup source.
optional SourceType source_type = 7; optional SourceType source_type = 9;
// The time from the startup source to the beginning of handling the startup event. // The time from the startup source to the beginning of handling the startup event.
// -1 means not available. // -1 means not available.
optional int32 source_event_delay_millis = 8; optional int32 source_event_delay_millis = 10;
} }
/** /**

View File

@@ -397,6 +397,13 @@ class ActivityMetricsLogger {
return -1; return -1;
} }
} }
PackageOptimizationInfo getPackageOptimizationInfo(ArtManagerInternal artManagerInternal) {
return artManagerInternal == null || launchedActivityAppRecordRequiredAbi == null
? PackageOptimizationInfo.createWithNoInfo()
: artManagerInternal.getPackageOptimizationInfo(applicationInfo,
launchedActivityAppRecordRequiredAbi, launchedActivityName);
}
} }
ActivityMetricsLogger(ActivityStackSupervisor supervisor, Looper looper) { ActivityMetricsLogger(ActivityStackSupervisor supervisor, Looper looper) {
@@ -857,14 +864,8 @@ class ActivityMetricsLogger {
info.bindApplicationDelayMs); info.bindApplicationDelayMs);
} }
builder.addTaggedData(APP_TRANSITION_WINDOWS_DRAWN_DELAY_MS, info.windowsDrawnDelayMs); builder.addTaggedData(APP_TRANSITION_WINDOWS_DRAWN_DELAY_MS, info.windowsDrawnDelayMs);
final ArtManagerInternal artManagerInternal = getArtManagerInternal();
final PackageOptimizationInfo packageOptimizationInfo = final PackageOptimizationInfo packageOptimizationInfo =
(artManagerInternal == null) || (info.launchedActivityAppRecordRequiredAbi == null) info.getPackageOptimizationInfo(getArtManagerInternal());
? PackageOptimizationInfo.createWithNoInfo()
: artManagerInternal.getPackageOptimizationInfo(
info.applicationInfo,
info.launchedActivityAppRecordRequiredAbi,
info.launchedActivityName);
builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_REASON, builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_REASON,
packageOptimizationInfo.getCompilationReason()); packageOptimizationInfo.getCompilationReason());
builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_FILTER, builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_FILTER,
@@ -985,6 +986,8 @@ class ActivityMetricsLogger {
builder.addTaggedData(APP_TRANSITION_PROCESS_RUNNING, builder.addTaggedData(APP_TRANSITION_PROCESS_RUNNING,
info.mProcessRunning ? 1 : 0); info.mProcessRunning ? 1 : 0);
mMetricsLogger.write(builder); mMetricsLogger.write(builder);
final PackageOptimizationInfo packageOptimizationInfo =
infoSnapshot.getPackageOptimizationInfo(getArtManagerInternal());
FrameworkStatsLog.write( FrameworkStatsLog.write(
FrameworkStatsLog.APP_START_FULLY_DRAWN, FrameworkStatsLog.APP_START_FULLY_DRAWN,
info.mLastLaunchedActivity.info.applicationInfo.uid, info.mLastLaunchedActivity.info.applicationInfo.uid,
@@ -995,6 +998,8 @@ class ActivityMetricsLogger {
info.mLastLaunchedActivity.info.name, info.mLastLaunchedActivity.info.name,
info.mProcessRunning, info.mProcessRunning,
startupTimeMs, startupTimeMs,
packageOptimizationInfo.getCompilationReason(),
packageOptimizationInfo.getCompilationFilter(),
info.mSourceType, info.mSourceType,
info.mSourceEventDelayMs); info.mSourceEventDelayMs);