1# Android System Server Startup Analyzer 2 3This is a tool for processing systraces and summarizing how long it takes 4to start `system_service` services. 5 6To run the tool, enter the root directory for the 7Trebuchet project and use the following command template: 8`./gradlew :trebuchet:system-server-analyzer:run --args="<trace_file> [-t threshold_ms] [-o output_file]"`. 9 10If you do not already have a trace file to analyze you can follow the steps 11below: 12 131.Stop `system_server`: 14 `adb shell stop` 152.Capture 10 seconds of tracing information using `atrace`: 16 `adb shell atrace -o /sdcard/atrace-ss.txt -t 10 ss` 173.In another console, restart `system_server`: 18 `adb shell start` 194.Pull the generate file: 20 `adb pull /sdcard/atrace-ss.txt` 21 22Below is an example of its output: 23 24``` 25Opening `/tmp/atrace-ss.txt` 26Progress: 100.00% 27Parsing atrace-ss.txt took 171ms 28 29StartServices: 5982.37ms 30StartActivityManager: 87.21ms 31StartPowerManager: 5.04ms 32StartLightsService: 1012.62ms 33StartDisplayManager: 7.08ms 34WaitForDisplay: 23.80ms 35StartPackageManagerService: 3267.64ms 36StartOverlayManagerService: 128.18ms 37StartBatteryService: 24.33ms 38StartUsageService: 29.94ms 39StartRollbackManagerService: 5.24ms 40InstallSystemProviders: 55.23ms 41StartWindowManagerService: 148.52ms 42SetWindowManagerService: 10.88ms 43WindowManagerServiceOnInitReady: 18.26ms 44NetworkWatchlistService: 5.87ms 45StartAccessibilityManagerService: 31.93ms 46MakeDisplayReady: 19.62ms 47StartStorageManagerService: 7.46ms 48StartLockSettingsService: 28.12ms 49StartWifi: 65.78ms 50StartConnectivityService: 11.89ms 51StartNotificationManager: 16.70ms 52StartAudioService: 37.19ms 53StartUsbService: 17.25ms 54StartJobScheduler: 13.70ms 55StartMediaSessionService: 8.07ms 56MakeLockSettingsServiceReady: 89.10ms 57StartBootPhaseLockSettingsReady: 16.21ms 58StartBootPhaseSystemServicesReady: 83.95ms 59MakeWindowManagerServiceReady: 5.40ms 60MakePowerManagerServiceReady: 14.79ms 61MakePackageManagerServiceReady: 48.18ms 62PhaseActivityManagerReady: 456.15ms 63Other: 157.12ms 64``` 65