PerfettoSdkTrace
object PerfettoSdkTrace
Allows for emitting trace events using Perfetto SDK.
Summary
Public functions |
|
|---|---|
Unit |
beginSection(sectionName: String)Writes a trace message to indicate that a given section of code has begun. |
Unit |
Writes a trace message to indicate that a given section of code has ended. |
Public properties |
|
|---|---|
Boolean |
Checks whether the tracing library has been loaded and the app has been registered with Perfetto SDK tracing server. |
Public functions
beginSection
fun beginSection(sectionName: String): Unit
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.
| Parameters | |
|---|---|
sectionName: String |
The name of the code section to appear in the trace. |
endSection
fun endSection(): Unit
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.
Public properties
isEnabled
val isEnabled: Boolean
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 |