1#!/bin/bash
2
3# usage (From root directory): ./scripts/run-user-switch-perf.sh <target user>
4
5# Runs user switch, collects a trace and prints out a summary of user switch
6# metrics - time taken by user start, user switch and user unlock and top 5
7# most expensive service in each category
8
9TargetUser=$1
10
11adb shell atrace -o /sdcard/atrace-ss.txt -t 10 ss &
12sleep 2
13adb shell am switch-user $TargetUser
14wait
15sleep 2
16adb pull /sdcard/atrace-ss.txt /tmp
17sleep 1
18./gradlew :trebuchet:user-switch-analyzer:run --args="/tmp/atrace-ss.txt -u $TargetUser"
19