Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 03-May-2024 | - | 120 | 61 | ||
MANIFEST.mf | D | 03-May-2024 | 62 | 3 | 2 | |
README.md | D | 03-May-2024 | 2.2 KiB | 53 | 44 | |
build.gradle | D | 03-May-2024 | 989 | 34 | 29 |
README.md
1# Android User Switch Analyzer 2 3This is a tool for processing atrace and summarizing how long 4user start, user switch and user unlock process takes during `user switching` 5 6It also provides the time takes by top 5 slowest services in each category 7 8To run the tool, enter the root directory for the 9Trebuchet project and use the following command template: 10`./gradlew :trebuchet:system-server-analyzer:run --args="<trace_file> [-u user_Id] [-o output_filename] [-c service_count]"`. 11 12If you do not already have a trace file to analyze you can follow the steps 13below: (Assuming switching from user 10 to user 11) 14 151.switch to user 10 16 `adb shell am switch-user 10` 172.Capture 15 seconds of tracing information using `atrace`: 18 `adb shell atrace -o /sdcard/atrace-ss.txt -t 15 ss` 193.In another console, switch to user 11: 20 `adb shell am switch-user 11` 214.Pull the generate file: 22 `adb pull /sdcard/atrace-ss.txt` 23 24Alternatively, run-user-switch-perf.sh script in the scripts folder 25 `./scripts/run-user-switch-perf.sh <from_user> <to_user>` 26 `./scripts/run-user-switch-perf.sh 10 11` 27 28Below is an example of its output: 29 30``` 31Opening /tmp/atrace-ss.txt 32Progress: 100.00% 33Parsing atrace-ss.txt took 161ms 34StartUser-11 duration: 175.161 ms 35com.android.server.policy.PermissionPolicyService 136.691 ms 36com.android.server.role.RoleManagerService 13.945 ms 37com.android.server.voiceinteraction.VoiceInteractionManagerService 10.931 ms 38com.android.server.locksettings.LockSettingsService$Lifecycle 2.052 ms 39com.android.server.devicepolicy.DevicePolicyManagerService$Lifecycle 1.231 ms 40SwitchUser-11 duration: 276.585 ms 41com.android.server.om.OverlayManagerService 253.871 ms 42com.android.server.inputmethod.InputMethodManagerService$Lifecycle 10.970 ms 43com.android.server.usb.UsbService$Lifecycle 1.021 ms 44com.android.server.media.MediaSessionService 0.522 ms 45com.android.server.media.projection.MediaProjectionManagerService 0.493 ms 46UnlockUser-11 duration: 72.586 ms 47com.android.server.autofill.AutofillManagerService 28.399 ms 48com.android.server.voiceinteraction.VoiceInteractionManagerService 16.270 ms 49com.android.server.accounts.AccountManagerService$Lifecycle 6.775 ms 50com.android.server.StorageManagerService$Lifecycle 4.069 ms 51com.android.internal.car.CarServiceHelperService 1.290 ms 52``` 53