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
This commit is contained in:
Fyodor Kupolov
2016-11-10 17:58:50 -08:00
parent fd869cfe53
commit 8d3e82bdfc

View File

@@ -51,6 +51,7 @@ import android.view.WindowManager;
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 @@ public final class SystemServer {
// 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 @@ public final class SystemServer {
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 @@ public final class SystemServer {
}
// 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).