xref: /aosp_15_r20/system/extras/app-launcher/README (revision 288bf5226967eb3dac5cce6c939ccc2a7f2b4fe5)
1*288bf522SAndroid Build Coastguard Worker		Instructions to Run (and modify) app-launcher script
2*288bf522SAndroid Build Coastguard Worker		----------------------------------------------------
3*288bf522SAndroid Build Coastguard Worker
4*288bf522SAndroid Build Coastguard WorkerIntroduction: app-launcher is a script that launches apps many times,
5*288bf522SAndroid Build Coastguard Workermeasures various system metrics, computes basic stats for the metrics
6*288bf522SAndroid Build Coastguard Workerand reports that stats.
7*288bf522SAndroid Build Coastguard Worker
8*288bf522SAndroid Build Coastguard WorkerSetup:
9*288bf522SAndroid Build Coastguard Worker1) Make sure the device is seen via 'adb devices' and authorize adb via the
10*288bf522SAndroid Build Coastguard Workerpopup dialog.
11*288bf522SAndroid Build Coastguard Worker2) Clear the setup wizard.
12*288bf522SAndroid Build Coastguard Worker3) Login to an android user test account.
13*288bf522SAndroid Build Coastguard Worker4) Clear the first time user dialogs on supported apps for your device (see
14*288bf522SAndroid Build Coastguard Workerbelow).
15*288bf522SAndroid Build Coastguard Worker5) Enable wifi and connect to a network (ex. GoogleGuest).
16*288bf522SAndroid Build Coastguard Worker
17*288bf522SAndroid Build Coastguard WorkerLaunching app-launcher :
18*288bf522SAndroid Build Coastguard Workerapp-launcher -a|-b|-u [-c|-v|-s <serial number>] num-iterations
19*288bf522SAndroid Build Coastguard Worker-a:Run on all cores
20*288bf522SAndroid Build Coastguard Worker-b:Run only big cores
21*288bf522SAndroid Build Coastguard Worker-c:pagecached. Don't drop pagecache before each launch (not default)
22*288bf522SAndroid Build Coastguard Worker-h:Dump help menu'
23*288bf522SAndroid Build Coastguard Worker-u:user experience, no change to cpu/gpu frequencies or governors'
24*288bf522SAndroid Build Coastguard Worker-v:Optional, Verbose mode, prints stats on a lot of metrics.
25*288bf522SAndroid Build Coastguard Worker-s <serial number>:Optional, specify serial number if multiple devices are
26*288bf522SAndroid Build Coastguard Worker                   attached to host
27*288bf522SAndroid Build Coastguard Workernum-iterations : Must be >= 100 to get statistically valid data.
28*288bf522SAndroid Build Coastguard Worker
29*288bf522SAndroid Build Coastguard WorkerNote, under -a|-b, we lock the CPU and GPU frequencies.
30*288bf522SAndroid Build Coastguard Worker
31*288bf522SAndroid Build Coastguard WorkerApps Supported :
32*288bf522SAndroid Build Coastguard WorkerOn phone, these 4 apps are launched
33*288bf522SAndroid Build Coastguard WorkerChrome
34*288bf522SAndroid Build Coastguard WorkerCamera
35*288bf522SAndroid Build Coastguard WorkerMaps
36*288bf522SAndroid Build Coastguard WorkerYoutube
37*288bf522SAndroid Build Coastguard Worker
38*288bf522SAndroid Build Coastguard WorkerOn Fugu (Google TV), these 3 apps are launched
39*288bf522SAndroid Build Coastguard WorkerYouTube
40*288bf522SAndroid Build Coastguard WorkerGames
41*288bf522SAndroid Build Coastguard WorkerMusic
42*288bf522SAndroid Build Coastguard Worker
43*288bf522SAndroid Build Coastguard WorkerTo add new apps, launch app manually and grep for package name +
44*288bf522SAndroid Build Coastguard Workeractivity name in logcat and add these to the launch_phone_apps()
45*288bf522SAndroid Build Coastguard Workerfunction.
46*288bf522SAndroid Build Coastguard Worker
47*288bf522SAndroid Build Coastguard WorkerAdding support for new Devices to app-launcher :
48*288bf522SAndroid Build Coastguard WorkerThere are a few bits of code needed to do this.
49*288bf522SAndroid Build Coastguard Worker1) Add a new cpufreq_<device> routine to fix the CPU/GPU frequencies
50*288bf522SAndroid Build Coastguard Workeras desired.
51*288bf522SAndroid Build Coastguard Worker2) Add logic that checks the $model obtained and check against your device.
52*288bf522SAndroid Build Coastguard Worker   (a) Then add code to call your cpufreq_<device> routine there
53*288bf522SAndroid Build Coastguard Worker   (b) (Optional) Add code to get the /system block device pathname. This is
54*288bf522SAndroid Build Coastguard Worker   only needed if you wan to get storage block device (/system) data.
55*288bf522SAndroid Build Coastguard Worker
56*288bf522SAndroid Build Coastguard WorkerAdding new Metrics to app-launcher :
57*288bf522SAndroid Build Coastguard WorkerYou can modify the way simpleperf is used in the script to collect
58*288bf522SAndroid Build Coastguard Workerdifferent metrics, but that will require a change to getstats() to
59*288bf522SAndroid Build Coastguard Workerparse the output as necessary. Adding new storage stats or other stats
60*288bf522SAndroid Build Coastguard Workercollected from /proc (or /sys) is definitely possible, but code needs
61*288bf522SAndroid Build Coastguard Workerto be written for that - modeled after the disk_stats_before/after
62*288bf522SAndroid Build Coastguard Workerfunctions.
63*288bf522SAndroid Build Coastguard Worker
64*288bf522SAndroid Build Coastguard WorkerNotes :
65*288bf522SAndroid Build Coastguard Worker
66*288bf522SAndroid Build Coastguard WorkerHere are the commands to launch/stop the various Apps of interest. The
67*288bf522SAndroid Build Coastguard Workerway to find the package and activity for the app of interest is to
68*288bf522SAndroid Build Coastguard Workerlaunch the app and then grep for it in logcat to find the
69*288bf522SAndroid Build Coastguard Workerpackage+activity and use that in am start.
70*288bf522SAndroid Build Coastguard Worker
71*288bf522SAndroid Build Coastguard WorkerChrome :
72*288bf522SAndroid Build Coastguard Workeradb shell 'simpleperf stat -a am start -W -n com.android.chrome/com.google.android.apps.chrome.Main'
73*288bf522SAndroid Build Coastguard Workeradb shell 'am force-stop com.android.chrome'
74*288bf522SAndroid Build Coastguard Worker
75*288bf522SAndroid Build Coastguard WorkerCamera :
76*288bf522SAndroid Build Coastguard Workeradb shell 'simpleperf stat -a am start -W -n com.google.android.GoogleCamera/com.android.camera.CameraActivity'
77*288bf522SAndroid Build Coastguard Workeradb shell 'am force-stop com.google.android.GoogleCamera'
78*288bf522SAndroid Build Coastguard Worker
79*288bf522SAndroid Build Coastguard WorkerMaps :
80*288bf522SAndroid Build Coastguard Workeradb shell 'simpleperf stat -a am start -W -n com.google.android.apps.maps/com.google.android.maps.MapsActivity'
81*288bf522SAndroid Build Coastguard Workeradb shell 'am force-stop com.google.android.apps.maps'
82*288bf522SAndroid Build Coastguard Worker
83*288bf522SAndroid Build Coastguard WorkerYoutube :
84*288bf522SAndroid Build Coastguard Workeradb shell 'am start -W -n com.google.android.youtube/com.google.android.apps.youtube.app.WatchWhileActivity'
85*288bf522SAndroid Build Coastguard Workeradb shell 'am force-stop com.google.android.youtube'
86*288bf522SAndroid Build Coastguard Worker
87*288bf522SAndroid Build Coastguard Worker
88