Most visited

Recently visited

TraceCompat

public final class TraceCompat
extends Object

java.lang.Object
   ↳ android.support.v4.os.TraceCompat


将跟踪事件写入系统跟踪缓冲区。 这些跟踪事件可以使用Systrace工具收集和可视化。

该跟踪机制独立于startMethodTracing()提供的方法跟踪机制。 特别是,它可以跟踪跨多个进程发生的事件。

有关使用Systrace工具的信息,请阅读 Analyzing Display and Performance with Systrace 。

Summary

Public methods

static void beginSection(String sectionName)

写一个跟踪消息来表示给定的一段代码已经开始。

static void endSection()

写入跟踪消息以指示给定代码段已结束。

Inherited methods

From class java.lang.Object

Public methods

beginSection

void beginSection (String sectionName)

写一个跟踪消息来表示给定的一段代码已经开始。 此调用之后必须在同一个线程上对endSection()进行相应的调用。

此时垂直条字符'|',换行符'\ n'和空字符'\ 0'由跟踪机制在内部使用。 如果sectionName包含这些字符,它们将被跟踪中的空格字符替换。

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

void endSection ()

写入跟踪消息以指示给定代码段已结束。 此呼叫必须先进行相应的beginSection(String)调用。 调用此方法将标记最近开始的代码段的结尾,因此必须小心确保beginSection / endSection对正确嵌套并从同一线程调用。

Hooray!