序
當一個人生病去看醫生,會說出症狀,醫生或做一些檢測來確認引起不良反應的原因。對於一個Android的裝置也一樣。在開發過程中,工程開發人員常會發現一些問題。這時候需要檢測裝置的發生原因。因此可以透過Android的內部紀錄訊息來檢測發生甚麼問題導致不良因素。
從何處下手?
Android 內有提供一個指令,稱為bugreport。可以透過指令adb bugreport adb shell bugreport來取得Bugreport中的資訊。使用這個指令取得Android 4.1的模擬器內的bugreport可得到以下的六十八種紀錄訊息。這些訊息可以用來診斷Android目前的健康情況。
UPTIME (uptime) |
MEMORY INFO (/proc/meminfo) |
CPU INFO (top -n 1 -d 1 -m 30 -t) |
PROCRANK (procrank) |
VIRTUAL MEMORY STATS (/proc/vmstat) |
VMALLOC INFO (/proc/vmallocinfo) |
SLAB INFO (/proc/slabinfo) |
ZONEINFO (/proc/zoneinfo) |
PAGETYPEINFO (/proc/pagetypeinfo) |
BUDDYINFO (/proc/buddyinfo) |
KERNEL WAKELOCKS (/proc/wakelocks) |
KERNEL CPUFREQ (/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state) |
PROCESSES (ps -P) |
PROCESSES AND THREADS (ps -t -p -P) |
LIBRANK (librank) |
KERNEL LOG (dmesg) |
LIST OF OPEN FILES (/system/xbin/su root lsof) |
SMAPS OF ALL PROCESSES |
SHOW MAP 1 (/init) (/system/xbin/su root showmap 1) |
BLOCKED PROCESS WAIT-CHANNELS |
SYSTEM LOG (logcat -v threadtime -d *:v) |
EVENT LOG (logcat -b events -v threadtime -d *:v) |
RADIO LOG (logcat -b radio -v threadtime -d *:v) |
VM TRACES JUST NOW (/data/anr/traces.txt.bugreport: 2012-10-17 08:21:46) |
VM TRACES AT LAST ANR (/data/anr/traces.txt: 2012-10-17 08:16:11) |
NETWORK DEV INFO (/proc/net/dev) |
QTAGUID NETWORK INTERFACES INFO (/proc/net/xt_qtaguid/iface_stat_all) |
QTAGUID NETWORK INTERFACES INFO (xt) (/proc/net/xt_qtaguid/iface_stat_fmt) |
QTAGUID CTRL INFO (/proc/net/xt_qtaguid/ctrl) |
QTAGUID STATS INFO (/proc/net/xt_qtaguid/stats) |
NETWORK ROUTES (/proc/net/route) |
NETWORK ROUTES IPV6 (/proc/net/ipv6_route) |
LAST KMSG (/proc/last_kmsg) |
LAST PANIC CONSOLE (/data/dontpanic/apanic_console) |
LAST PANIC THREADS (/data/dontpanic/apanic_threads) |
SYSTEM SETTINGS (/system/xbin/su root sqlite3 /data/… |
NETWORK INTERFACES (/system/xbin/su root netcfg) |
IP RULES (ip rule show) |
IP RULES v6 (ip -6 rule show) |
ROUTE TABLE 60 (ip route show table 60) |
ROUTE TABLE 61 v6 (ip -6 route show table 60) |
ROUTE TABLE 61 (ip route show table 61) |
ROUTE TABLE 61 v6 (ip -6 route show table 61) |
ARP CACHE (/proc/net/arp) |
IPTABLES (/system/xbin/su root iptables -L -nvx) |
IP6TABLES (/system/xbin/su root ip6tables -L -nvx) |
IPTABLE NAT (/system/xbin/su root iptables -t nat -L -nvx) |
IPTABLE RAW (/system/xbin/su root iptables -t raw -L -nvx) |
IP6TABLE RAW (/system/xbin/su root ip6tables -t raw -L -nvx) |
WIFI NETWORKS (/system/xbin/su root wpa_cli list_networks) |
SYSTEM PROPERTIES |
VOLD DUMP (vdc dump) |
SECURE CONTAINERS (vdc asec list) |
FILESYSTEMS & FREE SPACE (/system/xbin/su root df) |
PACKAGE SETTINGS (/system/xbin/su root cat /data/system/packages.xml) |
PACKAGE UID ERRORS (/data/system/uiderrors.txt: 2012-10-15 02:30:29) |
LAST RADIO LOG (parse_radio_log /proc/last_radio_log) |
BACKLIGHTS |
BINDER FAILED TRANSACTION LOG (/sys/kernel/debug/binder/failed_transaction_log) |
BINDER TRANSACTION LOG (/sys/kernel/debug/binder/transaction_log) |
BINDER TRANSACTIONS (/sys/kernel/debug/binder/transactions) |
BINDER STATS (/sys/kernel/debug/binder/stats) |
BINDER STATE (/sys/kernel/debug/binder/state) |
DUMP VENDOR RIL LOGS (/system/xbin/su root vril-dump) |
DUMPSYS (dumpsys) |
APP ACTIVITIES (dumpsys activity all) |
APP SERVICES (dumpsys activity service all) |
APP SERVICES (dumpsys activity provider all) |
在這些訊息中包含Android與Linux層的各種訊息,並能取得各種不同類別的訊息。例如,活動與事件、記憶體使用情形、系統狀態、射頻狀態,與網路狀態等。
值得探討的是,若產品是一個Android的手機或附有通訊功能的平板電腦。有些訊息包含電信通訊技術相關的底層訊息。這些訊息是通訊晶片與電信基定台的交換訊息。而在Bugreport的功能中可能無法傳遞這些訊息。需要特定的軟體或裝置去取得這些電信交換的訊息。
沒有留言:
張貼留言