Android Program Debugging Tools
Google provides us with the highlights of the Code Debugging tools: TraceView and Dmtracedump. With these two tools, we are very handy when we debug the bugs. TraceView helps us analyze program performance, dmtracedump generate function call diagrams. Unfortunately, Google provides the dmtracedump is a failure of the tool, and can not draw, this article will detail the solution, implementation of the drawing.
Generate. trace files
The Android.os.Debug class, in which important two methods debug.startmethodtracing () and debug.stopmethodtracing (). These two methods are used to create the. trace file, which starts at debug.startmethodtracing () and ends at Debug.stopmethodtracing (). All call procedures are saved in the. trace file, including information such as the name of the function called and the time it was executed.
Add the following code to the location of the debug start code and the termination position.
Debug.startmethodtracing ("test");
debug.stopmethodtracing ();
Where parameter test is the name of the trace file to create, Test.trace. The default path is/sdcard/test.trace, or you can make your own/data/log/test, indicating that the file is in/data/log/test.trace.
TraceView
Executing in the SDK:
./traceview Test.trace
We can get
1. Start and stop time for each thread in the program to invoke the method
2. Information and efficiency analysis of function execution