From ad06fbb848711022f249e528af8a1c9662648dcc Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Tue, 5 May 2015 18:36:42 -0700 Subject: Update ddms and profiling docs to include sample profiling. Bug: 5866094 Change-Id: Ib97990ee2fc823416b3f41856b815d4092818f98 --- docs/html/tools/debugging/debugging-tracing.jd | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'docs/html/tools/debugging/debugging-tracing.jd') diff --git a/docs/html/tools/debugging/debugging-tracing.jd b/docs/html/tools/debugging/debugging-tracing.jd index bd4afbc..098660b 100644 --- a/docs/html/tools/debugging/debugging-tracing.jd +++ b/docs/html/tools/debugging/debugging-tracing.jd @@ -127,7 +127,7 @@ parent.link=index.html {@link android.os.Debug#startMethodTracing() startMethodTracing()} methods. In the call, you specify a base name for the trace files that the system generates. To stop tracing, call {@link android.os.Debug#stopMethodTracing() stopMethodTracing()}. These methods start and stop method - tracing across the entire virtual machine. For example, you could call + tracing across the entire virtual machine. For example, you could call {@link android.os.Debug#startMethodTracing() startMethodTracing()} in your activity's {@link android.app.Activity#onCreate onCreate()} method, and call {@link android.os.Debug#stopMethodTracing() stopMethodTracing()} in that activity's @@ -157,6 +157,12 @@ parent.link=index.html times are only useful in relation to other profile output, so you can see if changes have made the code faster or slower relative to a previous profiling run.

+

In Android 4.4 and later, you can use sample-based profiling to profile with less runtime + performance impact. To enable sample profiling, call {@link + android.os.Debug#startMethodTracingSampling() startMethodTracingSampling()} with a specified + sampling interval. The system will then gather samples periodically until tracing is stopped + via {@link android.os.Debug#stopMethodTracing() stopMethodTracing()}.

+

Copying Trace Files to a Host Machine

After your application has run and the system has created your trace files @@ -277,7 +283,8 @@ dmtracedump [-ho] [-s sortable] [-d trace-base-name] [-g outfile] <trace-base Traceview logging does not handle threads well, resulting in these two problems:

    -
  1. If a thread exits during profiling, the thread name is not emitted;
  2. +
  3. If a thread exits during profiling, the thread name is not emitted (fixed in Android 5.1 + and later);
  4. The VM reuses thread IDs. If a thread stops and another starts, they may get the same ID.
  5. -- cgit v1.1