android system problems common commands

Performance Analysis:

-Android studio tool
Memory Monitor tool is mainly used to monitor the memory allocation of APP, determine whether there is a memory leak
Dump Java Heap locate memory leaks, generate .hprof
the Eclipse: ddms-> Update HEAP -> the cause is gc to generate total memory information, then there will be data object

- Error runtime analysis
/ data / tombstones
whole blogging platforms: / mnt / extsd / tombstones
addr2line tools and objdump tool to locate backtrace wrong
tool position: windows: ndk \ toolchains \ arm -linux-androideabi-4.9 \ prebuilt \ windows-x86_64 \ bin

  • arm-linux-androideabi-addr2line -C -f -e libss.so 00026cb3

-e option to specify the executable libss.so .
-f option, you can tell the tool output function name

  • arm-eabi-objdump -S libss.so > dvb_map.txt

- View memory footprint
the adb the shell procrank
the adb the shell dumpsys meminfo view program in the native layer <package_name> / pid

- View disk space
du -sH * View the current directory under the file space
df view the partition space

Key events:

adb shell getevent -t view the current value of the pressed key
Here Insert Picture Description
event type (0001), the event code (0074) and the value of the event (00000001)
the adb the shell GetEvent / dev / INPUT / event2 acquired event2 device event
adb shell input keyevent 4 Back button

Caton content performance analysis:

traceview and systrace
Systrace features include I / O operations, the kernel work queue, CPU load and operating conditions and other subsystems Android tracking system, TraceView visualization tools can be seen that long specific information code at runtime, the method call, frequency and time ratio, the efficiency of the process of understanding the code is run, thus targeted to improve the code
to use traceview find the current program or whether there are repeated calls to execute longer a function of time, followed by the code analysis, looking for suspicious point, if the first two steps can not accurately locate it, this time we can consider systrace
TraceView usage

  1. Ddms open, Start Method Profiling-> interface -> stop, operation is preferably not more than 5s
  2. android.os.Debug.startMethodTracing (); and android.os.Debug.stopMethodTracing (); trace file is then produced at sdcard directory, and then open the eclipse
    Systrace functions include tracking system I / O operations, the kernel work queue, the CPU load and operating conditions of various subsystems such as Android
    Java layer by android.os.Trace beginSection ( "Fragement_onCreateView"); class complete, native layer is completed by ATrace ATRACE_CALL macro.

Use anr log:

- java layer:
/data/anr/trace.txt
may be changed by modifying the path of the trace file system property dalvik.vm.stack-trace-file, the default path is /data/anr/traces.txt

- Native Layer:
Add code directly crawl
Google provides default CallStack API, please refer to the
System / Core / the include / libutils / CallStack.h
System / Core / libutils / CallStack.cpp
can quickly print a single thread backtrace

Automatically grab
after the exception process occurs Natice layer is generally in / data / tombstones directory file generating
arm-linux-androideabi -addr2line-f -C -e symbols address

MTK tool
using tool RTT (Runtime Trace) debuggerd gripping Native backtrace, the corresponding command is executed:

USAGE : rtt[-h] -f function -p pid [-t tid]
-ffuncion : current support functions: bt (Backtrace function)
-ppid : pid to trace
-ttid : tid to trace
nname : process name to trace
-h : help menu

-Kernel layer

  • AEE / RTT tool
  • cat proc/pid/task/tid/stack
  • proc / kmsg
    adbshell CAT proc / kmsg> kmsg.txt
    adbshell "echo. 8> proc / SYS / Kernel / the printk" LogLevel // Modify the printk
    adbshell "echo T> / proc / SysRq-Trigger" // print all backtrace
    adbshell " echo w> / proc / sysrq- trigger "// Print '-D' status'D 'of the process

Guess you like

Origin blog.csdn.net/zhzhangnews/article/details/92383355