Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d3e82bd authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

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
parent fd869cfe
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ import android.view.WindowManager;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.app.NightDisplayController;
import com.android.internal.app.NightDisplayController;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.BinderInternal;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.os.ZygoteInit;
import com.android.internal.os.ZygoteInit;
@@ -269,7 +270,9 @@ public final class SystemServer {


            // Here we go!
            // Here we go!
            Slog.i(TAG, "Entered the Android system server!");
            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
            // In case the runtime switched since last boot (such as when
            // the old runtime was removed in an OTA), set the system
            // the old runtime was removed in an OTA), set the system
@@ -358,6 +361,7 @@ public final class SystemServer {
        if (StrictMode.conditionallyEnableDebugLogging()) {
        if (StrictMode.conditionallyEnableDebugLogging()) {
            Slog.i(TAG, "Enabled StrictMode for system server main thread.");
            Slog.i(TAG, "Enabled StrictMode for system server main thread.");
        }
        }
        MetricsLogger.histogram(null, "boot_system_server_ready", (int) SystemClock.uptimeMillis());


        // Loop forever.
        // Loop forever.
        Looper.loop();
        Looper.loop();
@@ -486,13 +490,16 @@ public final class SystemServer {
        }
        }


        // Start the package manager.
        // Start the package manager.
        MetricsLogger.histogram(null, "boot_package_manager_init_start",
                (int) SystemClock.uptimeMillis());
        traceBeginAndSlog("StartPackageManagerService");
        traceBeginAndSlog("StartPackageManagerService");
        mPackageManagerService = PackageManagerService.main(mSystemContext, installer,
        mPackageManagerService = PackageManagerService.main(mSystemContext, installer,
                mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
                mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
        mFirstBoot = mPackageManagerService.isFirstBoot();
        mFirstBoot = mPackageManagerService.isFirstBoot();
        mPackageManager = mSystemContext.getPackageManager();
        mPackageManager = mSystemContext.getPackageManager();
        traceEnd();
        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
        // 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.
        // 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).
        // Note: this isn't needed during decryption (we don't have /data anyways).