From 26d715dacac25521dc6a14896f545be3c5329c9d Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 8 Oct 2020 20:09:45 +0800 Subject: [PATCH] Add ART optimization dimension to reportFullyDrawn Bug: 170310046 Test: adb shell cmd stats print-logs adb logcat | grep statsd | grep "(50)" Change-Id: I1d33ff4639c85d2b1f57f2fef72d883c3eed7f00 Merged-In: I1d33ff4639c85d2b1f57f2fef72d883c3eed7f00 (cherry picked from commit ec2e3ee7040b29e63999d510e9d550d426a07ee3) --- cmds/statsd/src/atoms.proto | 6 ++++++ .../server/wm/ActivityMetricsLogger.java | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 2bc153189e167..96a64bafd6417 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -3661,6 +3661,12 @@ message AppStartFullyDrawn { // App startup time (until call to Activity#reportFullyDrawn()). 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; } /** diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java index 5570c01773865..8f59eef495167 100644 --- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java +++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java @@ -372,6 +372,13 @@ class ActivityMetricsLogger { return -1; } } + + PackageOptimizationInfo getPackageOptimizationInfo(ArtManagerInternal artManagerInternal) { + return artManagerInternal == null || launchedActivityAppRecordRequiredAbi == null + ? PackageOptimizationInfo.createWithNoInfo() + : artManagerInternal.getPackageOptimizationInfo(applicationInfo, + launchedActivityAppRecordRequiredAbi, launchedActivityName); + } } ActivityMetricsLogger(ActivityStackSupervisor supervisor, Looper looper) { @@ -832,14 +839,8 @@ class ActivityMetricsLogger { info.bindApplicationDelayMs); } builder.addTaggedData(APP_TRANSITION_WINDOWS_DRAWN_DELAY_MS, info.windowsDrawnDelayMs); - final ArtManagerInternal artManagerInternal = getArtManagerInternal(); final PackageOptimizationInfo packageOptimizationInfo = - (artManagerInternal == null) || (info.launchedActivityAppRecordRequiredAbi == null) - ? PackageOptimizationInfo.createWithNoInfo() - : artManagerInternal.getPackageOptimizationInfo( - info.applicationInfo, - info.launchedActivityAppRecordRequiredAbi, - info.launchedActivityName); + info.getPackageOptimizationInfo(getArtManagerInternal()); builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_REASON, packageOptimizationInfo.getCompilationReason()); builder.addTaggedData(PACKAGE_OPTIMIZATION_COMPILATION_FILTER, @@ -958,6 +959,8 @@ class ActivityMetricsLogger { builder.addTaggedData(APP_TRANSITION_PROCESS_RUNNING, info.mProcessRunning ? 1 : 0); mMetricsLogger.write(builder); + final PackageOptimizationInfo packageOptimizationInfo = + infoSnapshot.getPackageOptimizationInfo(getArtManagerInternal()); FrameworkStatsLog.write( FrameworkStatsLog.APP_START_FULLY_DRAWN, info.mLastLaunchedActivity.info.applicationInfo.uid, @@ -967,7 +970,9 @@ class ActivityMetricsLogger { : FrameworkStatsLog.APP_START_FULLY_DRAWN__TYPE__WITHOUT_BUNDLE, info.mLastLaunchedActivity.info.name, info.mProcessRunning, - startupTimeMs); + startupTimeMs, + packageOptimizationInfo.getCompilationReason(), + packageOptimizationInfo.getCompilationFilter()); // Ends the trace started at the beginning of this function. This is located here to allow // the trace slice to have a noticable duration.