PerfettoSdkTrace
public static class PerfettoSdkTrace
Allows for emitting trace events using Perfetto SDK.
Summary
Public fields |
|
---|---|
static @NonNull PerfettoSdkTrace |
Public methods |
|
---|---|
final void |
beginSection(@NonNull String sectionName) Writes a trace message to indicate that a given section of code has begun. |
final void |
Writes a trace message to indicate that a given section of code has ended. |
final boolean |
Checks whether the tracing library has been loaded and the app has been registered with Perfetto SDK tracing server. |
Public fields
Public methods
beginSection
public final void beginSection(@NonNull 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.
endSection
public final void endSection()
Writes a trace message to indicate that a given section of code has ended. This call must be preceded by a corresponding call to beginSection
. 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.
isEnabled
public final boolean isEnabled()
Checks whether the tracing library has been loaded and the app has been registered with Perfetto SDK tracing server. This is useful to avoid intermediate string creation for trace sections that require formatting. It is not necessary to guard all Trace method calls as they internally already check this. However it is recommended to use this to prevent creating any temporary objects that would then be passed to those methods to reduce runtime cost when tracing isn't enabled.
Returns | |
---|---|
boolean |
true if tracing is currently enabled, false otherwise |