Traceview learning notes for Android tools

Source: Internet
Author: User

How to analyze the Android Application Performance and Java function call relationships.

1. mksdcard-l sdcard 512 M/root/. Android/sdcard. img

2. Add the start and end functions of trace to the application (For details, refer to the development documentation)

// Start tracing to "/sdcard/Calc. Trace"

Debug. startmethodtracing ("calc"); -------- calc is the name of the. trace file to be generated

//..

// Stop Tracing

Log. D ("lizhenghui", "nnnnnnn stop traceview debug ");

Debug. stopmethodtracing ();

3. Specify the sdcard directory when the emulator starts under the "run Configuraton --> additional emulator command line options" option of the target item in Eclipse:-sdcard/root/. Android/sdcard. img

4. run Android from eclipse.

5. Exit the application and use logcat to check whether the preceding log information appears. Make sure that the trace file is not empty.

6. ADB ls/sdcard/

We can see a file: Calc. Trace is the file we need.

7. Download the trace file to your local device.

ADB pull/sdcard/Calc. Trace ./

8. Traceview Calc. Trace

Open the trace file, and take a look at the help document with patience. You can see that the top part of this file is divided into a time relationship diagram, reflecting the time at which the function is executed. The lower part is divided into a function relationship diagram, it reflects the call relationship of a function. Meanings of the following items:

Name: Lists All call items. The preceding number is the number. Expand to show that the parent and children subitems are called and called.

Incl: percentage of the time taken to calculate the total time.

Passive: time used by the call. (Including the call time of all sub-methods)

Excl: percentage of the total execution time.

Exclusive: execution time, excluding the time of the sub-method.

Cballs + recur cballs/Total: number of calls and repeated calls

Time/call: the total time. MS)

9. Generate a function call Relationship Diagram

A. APT-Get install graphviz

B. dmtacedump-G aa.png Calc. Trace

C. ls images generate aa.png images.

10. Use the image tool to open an image.

11. Function display format on the image (using the example in the development document, I am using a remote Internet)

 

<ref> callname (<inc-ms>, <exc-ms>,<numcalls>)

  • Ref -- no.
  • callname-- Function name
  • <Inc -- MS> -- call time
  • <exc-ms>-- Execution time
  • <numcalls>-- Number of calls

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.