public class ComponentsSystrace
extends java.lang.Object
android.os.Trace
, but allows you to provide your own
functionality. Use it as
ComponentsSystrace.beginSection("tag"); ... ComponentsSystrace.endSection();
As a
default, it simply calls android.os.Trace
(see DefaultComponentsSystrace
). You
may supply your own with provide(Systracer)
.
Modifier and Type | Method and Description |
---|---|
static void |
beginAsyncSection(java.lang.String name)
Writes a trace message to indicate that a given section of code has begun.
|
static void |
beginAsyncSection(java.lang.String name,
int cookie)
Writes a trace message to indicate that a given section of code has begun.
|
static void |
beginSection(java.lang.String name)
Writes a trace message to indicate that a given section of code has begun.
|
static Systracer.ArgsBuilder |
beginSectionWithArgs(java.lang.String name) |
static void |
endAsyncSection(java.lang.String name)
Writes a trace message to indicate that the current method has ended.
|
static void |
endAsyncSection(java.lang.String name,
int cookie)
Writes a trace message to indicate that the current method has ended.
|
static void |
endSection()
Writes a trace message to indicate that a given section of code has ended.
|
static Systracer |
getSystrace() |
static boolean |
isTracing() |
static void |
provide(Systracer instance)
This should be called exactly once at app startup, before any Litho work happens.
|
public static void provide(Systracer instance)
public static Systracer getSystrace()
public static void beginSection(java.lang.String name)
endSection()
on the same thread.public static void beginAsyncSection(java.lang.String name)
endAsyncSection(String)
using the same tag. Unlike beginSection(String)
and endSection()
, asynchronous events do not need to be nested.
The name and cookie used to begin an event must be used to end it.
Depending on provided Systracer
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static void beginAsyncSection(java.lang.String name, int cookie)
endAsyncSection(String, int)
using the same tag. Unlike beginSection(String)
and endSection()
, asynchronous events do not need to be nested.
The name and cookie used to begin an event must be used to end it.
Depending on provided Systracer
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static Systracer.ArgsBuilder beginSectionWithArgs(java.lang.String name)
public static void endSection()
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.public static void endAsyncSection(java.lang.String name)
beginAsyncSection(String)
using the same tag, name and cookie.
Depending on provided Systracer
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static void endAsyncSection(java.lang.String name, int cookie)
beginAsyncSection(String, int)
using the same tag, name and
cookie.
Depending on provided Systracer
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static boolean isTracing()