Android Tips and Tricks 2010 10
Android Tips and Tricks 2010 10
Overview
Intro to Android
Performance tools
Resources
Intro to Android
Git
Repo
Building fast
Making a new program in the build
system
Repo
Build system
Help
choosecombo/lunch
jgrep/cgrep
godir
Fast building
'make -j6'
'export USE_CCACHE=1'
Great for rebuilds
e.g. ANDROID/external/myprogram
Fastboot
ADB
Development configurations
Fastboot
Fastboot operations
Install kernel
Install new image
Boot directly from host
ADB
shell [<command>]
push/pull
Logcat
Install/uninstall
http://developer.android.com/guide/develo
ping/tools/adb.html
ADB (cont.)
It's simple:
Development configurations
Host
Target
USB
Network
Serial
Functionality testing
Host
Power control
Network
Kernel
Target
TFTP
NFS
Root filesystem
Host
Integration and
Performance testing
Target
USB
Network
kernel
root
fs
data
flash
Strace
Bootchart
Dumpsys
Ddms
Gdb
Kernel log
Logcat
Logcat
N1:
preloaded 1942 classes in 5360ms
Time to scan packages: 8.975 seconds
EVM:
preloaded 1942 classes in 13619ms
Time to scan packages: 19.731 seconds
Stdio redirection
Strace
Shows system calls for a process (or set of
processes)
Is part of AOSP since Eclair
Can add to init.rc to trace initialization.
For example, to trace zygote startup, in /init.rc
change:
service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
to
service zygote /system/xbin/strace -tt -o/data/boot.strace /system/bin/app_process -Xzygote
/system/bin --zygote --start-system-server
Bootchart
'init' gathers data on startup
Must re-compile 'init' with support for bootchart
data collection
Bootchart output
Debug tools
Ddms
Gdb
DDMS
GDB
Performance Tools
Smem
Traceview
Dalvik JIT profiler??
Perf??
Smem
See http://elinux.org/Using_smem_on_Android
Traceview
Perf
Miscellaneous tools
procrank
setprop/getprop
sqlite (command line)
start/stop
Procrank
See http://elinux.org/Android_Memory_Usage
Output:
# procrank
PID
Vss
1217
36848K
1276
32200K
1189
26920K
1321
20328K
1356
20360K
1303
20184K
1271
19888K
1332
19560K
1187
5068K
1384
436K
1
212K
753
572K
748
340K
751
388K
1215
148K
757
352K
760
404K
759
312K
749
288K
752
244K
Rss
35648K
32200K
26920K
20328K
20360K
20184K
19888K
19560K
5068K
436K
212K
572K
340K
388K
148K
352K
404K
312K
288K
244K
Pss
17983K
14048K
9293K
4743K
4621K
4381K
4297K
3993K
2119K
248K
200K
171K
163K
156K
136K
117K
104K
102K
96K
71K
Uss
13956K
10116K
5500K
2344K
2148K
1724K
1764K
1620K
1476K
236K
200K
136K
152K
140K
136K
92K
80K
88K
84K
60K
cmdline
system_server
android.process.acore
zygote
android.process.media
com.android.email
com.android.settings
com.android.inputmethod.latin
com.android.alarmclock
/system/bin/mediaserver
procrank
/init
/system/bin/rild
/system/bin/sh
/system/bin/vold
/sbin/adbd
/system/bin/dbus-daemon
/system/bin/keystore
/system/bin/installd
/system/bin/servicemanager
/system/bin/debuggerd
setprop/getprop
Sqlite
Wrapup
Resources
eLinux wiki Android portal:
http://elinux.org/Android_Portal
Use android-porting, android-platform, and
android-kernel mailing lists, depending on
where your issue is
See
http://elinux.org/Android_Web_Resources#Mailing_Lists
Git