ComponentsSystrace
This is intended as a hook into android.os.Trace
, but allows you to provide your own functionality. Use it as
ComponentsSystrace.beginSection("tag"); ... ComponentsSystrace.endSection();
in Java. Or as
ComponentsSystrace.trace("tag") { ... }
in Kotlin. As a default, it simply calls android.os.Trace
(see DefaultComponentsSystrace). You may supply your own with ComponentsSystrace.provide.
Properties
Functions
Writes a trace message to indicate that a given section of code has begun. Must be followed by a call to .endAsyncSection using the same tag. Unlike .beginSection 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.
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.
Writes a trace message to indicate that the current method has ended. Must be called exactly once for each call to .beginAsyncSection using the same tag, name and cookie.
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.
A convenience Kotlin API that can be used instead of manually calling ComponentsSystrace.beginSection and ComponentsSystrace.endSection.