Report boot statistics
Added the following metrics:
- tron_varz_boot_package_manager_init_start
- tron_varz_boot_package_manager_init_ready
- tron_varz_boot_system_server_init
- tron_varz_boot_system_server_ready
Test: manual - device boots, adb logcat -b events
Bug: 32780225
Change-Id: I0eeda831e2a13a7cbcef3308d5dad1bfa63919c1
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index cc96f56..8fd0a17 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -51,6 +51,7 @@
import com.android.internal.R;
import com.android.internal.app.NightDisplayController;
+import com.android.internal.logging.MetricsLogger;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.os.ZygoteInit;
@@ -269,7 +270,9 @@
// Here we go!
Slog.i(TAG, "Entered the Android system server!");
- EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, SystemClock.uptimeMillis());
+ int uptimeMillis = (int) SystemClock.uptimeMillis();
+ EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, uptimeMillis);
+ MetricsLogger.histogram(null, "boot_system_server_init", uptimeMillis);
// In case the runtime switched since last boot (such as when
// the old runtime was removed in an OTA), set the system
@@ -358,6 +361,7 @@
if (StrictMode.conditionallyEnableDebugLogging()) {
Slog.i(TAG, "Enabled StrictMode for system server main thread.");
}
+ MetricsLogger.histogram(null, "boot_system_server_ready", (int) SystemClock.uptimeMillis());
// Loop forever.
Looper.loop();
@@ -486,13 +490,16 @@
}
// Start the package manager.
+ MetricsLogger.histogram(null, "boot_package_manager_init_start",
+ (int) SystemClock.uptimeMillis());
traceBeginAndSlog("StartPackageManagerService");
mPackageManagerService = PackageManagerService.main(mSystemContext, installer,
mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
mFirstBoot = mPackageManagerService.isFirstBoot();
mPackageManager = mSystemContext.getPackageManager();
traceEnd();
-
+ MetricsLogger.histogram(null, "boot_package_manager_init_ready",
+ (int) SystemClock.uptimeMillis());
// Manages A/B OTA dexopting. This is a bootstrap service as we need it to rename
// A/B artifacts after boot, before anything else might touch/need them.
// Note: this isn't needed during decryption (we don't have /data anyways).