Skip to content

Most visited

Recently visited

navigation

Trace

public final class Trace
extends Object

java.lang.Object
   ↳ android.os.Trace


Writes trace events to the system trace buffer. These trace events can be collected and visualized using the Systrace tool.

This tracing mechanism is independent of the method tracing mechanism offered by startMethodTracing(). In particular, it enables tracing of events that occur across multiple processes.

For information about using the Systrace tool, read Analyzing Display and Performance with Systrace.

Summary

Public methods

static void beginSection(String sectionName)

Writes a trace message to indicate that a given section of code has begun.

static void endSection()

Writes a trace message to indicate that a given section of code has ended.

Inherited methods

From class java.lang.Object

Public methods

beginSection

Added in API level 18
void beginSection (String sectionName)

Writes a trace message to indicate that a given section of code has begun. This call must be followed by a corresponding call to endSection() on the same thread.

At this time the vertical bar character '|', newline character '\n', and null character '\0' are used internally by the tracing mechanism. If sectionName contains these characters they will be replaced with a space character in the trace.

Parameters
sectionName String: The name of the code section to appear in the trace. This may be at most 127 Unicode code units long.

endSection

Added in API level 18
void endSection ()

Writes a trace message to indicate that a given section of code has ended. This call must be preceeded by a corresponding call to beginSection(String). Calling this method will mark the end of the most recently begun section of code, so care must be taken to ensure that beginSection / endSection pairs are properly nested and called from the same thread.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.