Language

Debug.StartMethodTracing Method

Definition

Overloads

Name Description
StartMethodTracing()

Start method tracing with default log name and buffer size.

StartMethodTracing(String)

Start method tracing, specifying the trace log file path.

StartMethodTracing(String, Int32)

Start method tracing, specifying the trace log file name and the buffer size.

StartMethodTracing(String, Int32, DebugTraceOptions)

Start method tracing, specifying the trace log file name, the buffer size, and flags.

StartMethodTracing()

Start method tracing with default log name and buffer size.

[Android.Runtime.Register("startMethodTracing", "()V", "")]
public static void StartMethodTracing();
[<Android.Runtime.Register("startMethodTracing", "()V", "")>]
static member StartMethodTracing : unit -> unit
Attributes

Remarks

Start method tracing with default log name and buffer size.

By default, the trace file is called "dmtrace.trace" and it's placed under your package-specific directory on primary shared/external storage, as returned by Context#getExternalFilesDir(String).

See Inspect Trace Logs with Traceview for information about reading trace files.

When method tracing is enabled, the VM will run more slowly than usual, so the timings from the trace files should only be considered in relative terms (e.g. was run #1 faster than run #2). The times for native methods will not change, so don't try to use this to compare the performance of interpreted and native implementations of the same method. As an alternative, consider using sampling-based method tracing via #startMethodTracingSampling(String, int, int) or "native" tracing in the emulator via #startNativeTracing().

Java documentation for android.os.Debug.startMethodTracing().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

StartMethodTracing(String)

Start method tracing, specifying the trace log file path.

[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;)V", "")]
public static void StartMethodTracing(string? tracePath);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;)V", "")>]
static member StartMethodTracing : string -> unit

Parameters

tracePath
String

Path to the trace log file to create. If null, this will default to "dmtrace.trace". If the file already exists, it will be truncated. If the path given does not end in ".trace", it will be appended for you.

Attributes

Remarks

Start method tracing, specifying the trace log file path.

When a relative file path is given, the trace file will be placed under your package-specific directory on primary shared/external storage, as returned by Context#getExternalFilesDir(String).

See Inspect Trace Logs with Traceview for information about reading trace files.

When method tracing is enabled, the VM will run more slowly than usual, so the timings from the trace files should only be considered in relative terms (e.g. was run #1 faster than run #2). The times for native methods will not change, so don't try to use this to compare the performance of interpreted and native implementations of the same method. As an alternative, consider using sampling-based method tracing via #startMethodTracingSampling(String, int, int) or "native" tracing in the emulator via #startNativeTracing().

Java documentation for android.os.Debug.startMethodTracing(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

StartMethodTracing(String, Int32)

Start method tracing, specifying the trace log file name and the buffer size.

[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;I)V", "")]
public static void StartMethodTracing(string? tracePath, int bufferSize);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;I)V", "")>]
static member StartMethodTracing : string * int -> unit

Parameters

tracePath
String

Path to the trace log file to create. If null, this will default to "dmtrace.trace". If the file already exists, it will be truncated. If the path given does not end in ".trace", it will be appended for you.

bufferSize
Int32

The maximum amount of trace data we gather. If not given, it defaults to 8MB.

Attributes

Remarks

Start method tracing, specifying the trace log file name and the buffer size.

When a relative file path is given, the trace file will be placed under your package-specific directory on primary shared/external storage, as returned by Context#getExternalFilesDir(String).

See Inspect Trace Logs with Traceview for information about reading trace files.

When method tracing is enabled, the VM will run more slowly than usual, so the timings from the trace files should only be considered in relative terms (e.g. was run #1 faster than run #2). The times for native methods will not change, so don't try to use this to compare the performance of interpreted and native implementations of the same method. As an alternative, consider using sampling-based method tracing via #startMethodTracingSampling(String, int, int) or "native" tracing in the emulator via #startNativeTracing().

Java documentation for android.os.Debug.startMethodTracing(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

StartMethodTracing(String, Int32, DebugTraceOptions)

Start method tracing, specifying the trace log file name, the buffer size, and flags.

[Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;II)V", "")]
public static void StartMethodTracing(string? tracePath, int bufferSize, Android.OS.DebugTraceOptions flags);
[<Android.Runtime.Register("startMethodTracing", "(Ljava/lang/String;II)V", "")>]
static member StartMethodTracing : string * int * Android.OS.DebugTraceOptions -> unit

Parameters

tracePath
String

Path to the trace log file to create. If null, this will default to "dmtrace.trace". If the file already exists, it will be truncated. If the path given does not end in ".trace", it will be appended for you.

bufferSize
Int32

The maximum amount of trace data we gather. If not given, it defaults to 8MB.

flags
DebugTraceOptions

Flags to control method tracing. The following flags are supported: 0x0001 #TRACE_COUNT_ALLOCS

                   Flags to control time source: These are available with API #34 and higher.
                   0x0010 Report the elapsed time since the start of the trace.
                   0x0100 Report the time the thread has spent on the CPU since the start of the
                          trace. Please note that the thread cpu incurs a significant (typically
                          2-3x) performance penalty. Use this flag only when necessary.
                   If neither of these flags are set, both the elapsed time and the thread cpu time
                   are reported.
Attributes

Remarks

Start method tracing, specifying the trace log file name, the buffer size, and flags.

When a relative file path is given, the trace file will be placed under your package-specific directory on primary shared/external storage, as returned by Context#getExternalFilesDir(String).

See Inspect Trace Logs with Traceview for information about reading trace files.

When method tracing is enabled, the VM will run more slowly than usual, so the timings from the trace files should only be considered in relative terms (e.g. was run #1 faster than run #2). The times for native methods will not change, so don't try to use this to compare the performance of interpreted and native implementations of the same method. As an alternative, consider using sampling-based method tracing via #startMethodTracingSampling(String, int, int) or "native" tracing in the emulator via #startNativeTracing().

Java documentation for android.os.Debug.startMethodTracing(java.lang.String, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to