public class ComponentsSystrace extends 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(Systrace)
.
Modifier and Type | Class and Description |
---|---|
static interface |
ComponentsSystrace.ArgsBuilder
Object that accumulates arguments.
|
static interface |
ComponentsSystrace.Systrace |
Modifier and Type | Field and Description |
---|---|
static ComponentsSystrace.ArgsBuilder |
NO_OP_ARGS_BUILDER
Convenience implementation of ArgsBuilder to use when we aren't tracing.
|
Modifier and Type | Method and Description |
---|---|
static void |
beginSection(String name)
Writes a trace message to indicate that a given section of code has begun.
|
static void |
beginSectionAsync(String name)
Writes a trace message to indicate that a given section of code has begun.
|
static void |
beginSectionAsync(String name,
int cookie)
Writes a trace message to indicate that a given section of code has begun.
|
static ComponentsSystrace.ArgsBuilder |
beginSectionWithArgs(String name) |
static void |
endSection()
Writes a trace message to indicate that a given section of code has ended.
|
static void |
endSectionAsync(String name)
Writes a trace message to indicate that the current method has ended.
|
static void |
endSectionAsync(String name,
int cookie)
Writes a trace message to indicate that the current method has ended.
|
static ComponentsSystrace.Systrace |
getSystrace() |
static boolean |
isTracing() |
static void |
provide(ComponentsSystrace.Systrace instance)
This should be called exactly once at app startup, before any Litho work happens.
|
public static final ComponentsSystrace.ArgsBuilder NO_OP_ARGS_BUILDER
public static void provide(ComponentsSystrace.Systrace instance)
public static ComponentsSystrace.Systrace getSystrace()
public static void beginSection(String name)
endSection()
on the same thread.public static void beginSectionAsync(String name)
endSectionAsync(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 ComponentsSystrace.Systrace
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static void beginSectionAsync(String name, int cookie)
endSectionAsync(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 ComponentsSystrace.Systrace
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static ComponentsSystrace.ArgsBuilder beginSectionWithArgs(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 endSectionAsync(String name)
beginSectionAsync(String)
using the same tag, name and cookie.
Depending on provided ComponentsSystrace.Systrace
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static void endSectionAsync(String name, int cookie)
beginSectionAsync(String, int)
using the same tag, name and
cookie.
Depending on provided ComponentsSystrace.Systrace
instance, this method could vary in
behavior and in DefaultComponentsSystrace
it is a no-op.
public static boolean isTracing()