Introduction to the Android code debugging tools TraceView and Dmtracedump

Source: Internet
Author: User
Tags log

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

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.