Android Bugreport Analysis

Source: Internet
Author: User
Tags system log cpu usage
reproduced from: http://blog.sina.com.cn/s/blog_86d3fabb0100yff9.html Author: blueskyhff_firef


Get Log from Androidsystem

ADB bugreport> Bugreport.txt

Copy bugreport tothe current directory.

Bugreport contains a variety of log information, most of the log can be directly run by the relevant program to obtain directly.

The steps are as follows:

1.ADB shell2. Access to the relevant tool program directory 3. Execute the relevant program 4. Get relevant information

The following is an example of output process information 1.adbshell 2. Enter Ps-p 3. You can see the related process information Log Archive analysis 1.bugreport

Bugreport logs the android boot process log and the system state after it starts, including the process list, memory information, VM information, and so on. 2.bugreport Structure Analysis (1) dumpstate

MEMORY INFO

Get this log: Read file/proc/meminfo

System memory Usage Status

CPU INFO

Get this log: Perform/system/bin/top-n 1-d 1-m 30-t

System CPU Usage Status

Procrank

Get this log: Execute/system/bin/procrank

/system/xbin/procrank the results of the output after the execution, to see some memory usage status

VIRTUAL Memorystats

Get this log: Read file/proc/vmstat

Virtual memory allocation

Vmalloc applications are located between Vmalloc_start~vmalloc_end, and there is no simple conversion relationship with physical addresses, although logically they are continuous, but they do not require continuity in physics.

Vmalloc INFO

Get this log: Read file/proc/vmallocinfo

Virtual memory allocation

Slab INFO

Get this log: Read file/proc/slabinfo

Slab is a memory allocator. Here, some information about the allocator is exported

Zoneinfo

Get this log: Read file/proc/zoneinfo

Zone Info

Systemlog (need to focus on analysis)

Get this log: Perform/system/bin/logcat-v time-d *:v

Logs output in the program to analyze the current state of the system

VM traces

Get this log: Read file/data/anr/traces.txt

Because each program is running in its own VM, this log is some traces of the actual VM

EVENT Logtags

Get this log: Read file/etc/event-log-tags

EVENT LOG

Get this log: Perform/system/bin/logcat-b events-v time-d *:v

Output some of the event log

RADIO LOG

Get this log: Perform/system/bin/logcat-b radio-v time-d *:v

Displays the link state of some wireless devices, such as GSM,PHONE,STK (satellite Tool Kit) ...

Network state

Get this log: Execute/system/bin/netcfg (Get Network link state)

Get this log: Read file/proc/net/route (get routing status)

Show Network links and routes

Systemproperties

Get this log: reference code implementation

Displays some system properties, such as version,services,network ...

KERNEL LOG

Get this log: Execute/SYSTEM/BIN/DMESG

Log showing the Android kernel output

Kernelwakelocks

Get this log: Read file/proc/wakelocks

Some of the records that the kernel wakes up and sleeps with some programs and services

Kernelcpufreq

(Linux kernelcpufreq subsystem) Clock scaling allows the clockspeed of the CPUs on the fly.

This is a nicemethod to save battery power, because the lower clock speed the is,the.

Processes

Get this log: Execute ps-p

Show Current process

Processes Andthreads

Get this log: Execute ps-t-p-p

Show current processes and threads

Librank

Get this log: Execute/system/xbin/librank

Eliminate unnecessary library

BINDER failedtransaction LOG

Get this log: Read file/proc/binder/failed_transaction_log

Bindertransaction LOG

Get this log: Read file/proc/binder/transaction_log

Bindertransactions

Get this log: Read file/proc/binder/transactions

BINDER STATS

Get this log: Read file/proc/binder/stats

BINDER processstate

Get this log: Read file/proc/binder/proc/*

Some states related to bind

Filesystems

Get this log: Execute/SYSTEM/BIN/DF

Some capacity usage status of the primary file (Cache,sqlite,dev ...)

Packagesettings

Get this log: Read file/data/system/packages.xml

Some of the state of package in the system (access rights, paths ...), like some LNK files in Windows.

PACKAGE uiderrors

Get this log: Read file/data/system/uiderrors.txt

Error message

KERNEL last Kmsglog

Latest Kernel MessageLog

Last Radiolog

Latest Radio Log

KERNEL Panicconsole LOG

KERNEL panicthreads LOG

Some error message log for console/thread

Backlights

Get this log: Get lcdbrightness read/sys/class/leds/lcd-backlight/brightness

Get this log: Get buttonbrightness read/sys/class/leds/button-backlight/brightness

Get this log: Get keyboardbrightness read/sys/class/leds/keyboard-backlight/brightness

Get this log: Get Alsmode read/sys/class/leds/lcd-backlight/als

Get this log: Get Lcddriver registers Read/sys/class/leds/lcd-backlight/registers

Get some information about the relative brightness (2) Build.prop

Versioninfo Output The following information
Current time
Current kernel version: can read files (/proc/version) get
Display current command: can read folder (/proc/cmdline) get
Displays some properties of the system build: You can read the file (/system/build.prop) to get
Output system Some properties
Gsm.version.ril-impl
Gsm.version.baseband
Gsm.imei
Gsm.sim.operator.numeric
Gsm.operator.alpha (3) Dumpsys

This log can be obtained after executing the/system/bin/dumpsys.
It is often found that the log output is incomplete because the code requires the tool to perform a maximum of 60ms and may cause the log to not be fully exported.
The log can be guaranteed to be fully exported by modifying the time parameter.
Information:
Currently running services
DUMP of SERVICE Services-name (running) Log Code Analysis

Site:. " Frameworks "Base" Cmds "Dumpstate"

The code of the related log program can obtain the log analysis Experience analytical steps from the above directory

1. View some version information
System environment to identify problems
2. View the use of cpu/memory
See if there is memory exhaustion, the CPU is busy such a background situation appears.
3. Analysis of Traces
Because traces are some thread stack information that is output after a system error, you can quickly locate the problem.
4. Analyze System LOG
System log detailed output of a variety of log, you can find the relevant log for each analysis of the case analysis

The following analysis I wrote a test example, in the OnCreate to do a dead loop, so that the main thread will be locked in the hardware after the back of the ANR error.
The stack information for the program found in traces is as follows:

-----pid 20597at 2010-03-15 01:29:53-----
CMD Line:com.android.test
Dalvik THREADS:
"Main" prio=5 tid=3 timed_wait
| group= "main" scount=1 dscount=0 s=n obj=0x2aac6240self=0xbda8
| systid=20597 nice=0 sched=0/0 cgrp=defaulthandle=1877232296
At Java.lang.VMThread.sleep (Native method)
At Java.lang.Thread.sleep (thread.java:1306)
At Java.lang.Thread.sleep (thread.java:1286)
At Android.os.SystemClock.sleep (systemclock.java:114)
At Com.android.test.main.onCreate (main.java:20)
Atandroid.app.Instrumentation.callActivityOnCreate (instrumentation.java:1047)
Atandroid.app.ActivityThread.performLaunchActivity (activitythread.java:2459)
Atandroid.app.ActivityThread.handleLaunchActivity (activitythread.java:2512)
atandroid.app.activitythread.access$2200 (activitythread.java:119)
Atandroid.app.activitythread$h.handlemessage (activitythread.java:1863)
At Android.os.Handler.dispatchMessage (handler.java:99)
At Android.os.Looper.loop (looper.java:123)
Atandroid.app.ActivityThread.main (activitythread.java:4363)
At Java.lang.reflect.Method.invokeNative (Native method)
At Java.lang.reflect.Method.invoke (method.java:521)
Atcom.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:868)
Atcom.android.internal.os.ZygoteInit.main (zygoteinit.java:626)
At Dalvik.system.NativeStart.main (Native method)
"Binder Thread #2" prio=5 tid=11 NATIVE
| group= "main" scount=1 dscount=0 s=n obj=0x2fb7c260self=0x143860
| systid=20601 nice=0 sched=0/0 cgrp=defaulthandle=1211376
At Dalvik.system.NativeStart.run (Native method)
"Binder Thread #1" prio=5 tid=9 NATIVE
| group= "main" scount=1 dscount=0 s=n obj=0x2fb7c1a0self=0x14c980
| systid=20600 nice=0 sched=0/0 cgrp=defaulthandle=1207920
At Dalvik.system.NativeStart.run (Native method)
"Signal catcher" Daemon prio=5 tid=7 RUNNABLE
| Group= "System" scount=0 dscount=0 s=n obj=0x2fb7a1e8self=0x126cc0
| systid=20599 nice=0 sched=0/0 cgrp=defaulthandle=1269048
At Dalvik.system.NativeStart.run (Native method)
"Heapworker" Daemon prio=5 tid=5 vmwait
| Group= "System" scount=1 dscount=0 s=n OBJ=0X2E31DAF0SELF=0X135C08
| systid=20598 nice=0 sched=0/0 cgrp=defaulthandle=1268528
At Dalvik.system.NativeStart.run (Native method)
-----End 20597-----

The stack structure of the file is analyzed from bottom to top
(1) bottom of stack at Dalvik.system.NativeStart.run (Native method)
The system starts a dedicated virtual machine for the current task (application)
(2) atandroid.app.ActivityThread.performLaunchActivity (activitythread.java:2459)
Activity Services is responsible for managing the activity in the background, and it starts the activity of the test example at this time.
(3) at Com.android.test.main.onCreate (main.java:20)
Start the test program
(4) Stack top at Java.lang.VMThread.sleep (Native method)
The thread was sleep-deprived, so it was unable to respond to the user and a ANR error occurred.

The above is an analysis of a very simple problem.

You also need to analyze system LOG in detail if you encounter more complex problems.
1. For example, network anomalies, through the system log output of the network link information to determine the status of the network
2. Data transmission, network links and other time-consuming operations need to analyze the system log Activitymanager response time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.