public class TimingLogger
extends java.lang.Object
TimingLogger timings = new TimingLogger(TAG, "methodA");
// ... do some work A ...
timings.addSplit("work A");
// ... do some work B ...
timings.addSplit("work B");
// ... do some work C ...
timings.addSplit("work C");
timings.dumpToLog();
The dumpToLog call would add the following to the log:
D/TAG ( 3459): methodA: begin
D/TAG ( 3459): methodA: 9 ms, work A
D/TAG ( 3459): methodA: 1 ms, work B
D/TAG ( 3459): methodA: 6 ms, work C
D/TAG ( 3459): methodA: end, 16 ms
| Constructor and Description |
|---|
TimingLogger(java.lang.String tag,
java.lang.String label)
Create and initialize a TimingLogger object that will log using
the specific tag.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSplit(java.lang.String splitLabel)
Add a split for the current time, labeled with splitLabel.
|
void |
dumpToLog()
Dumps the timings to the log using Timber.d().
|
void |
reset()
Clear and initialize a TimingLogger object that will log using
the tag and label that was specified previously, either via
the constructor or a call to reset(tag, label).
|
void |
reset(java.lang.String tag,
java.lang.String label)
Clear and initialize a TimingLogger object that will log using
the specific tag.
|
public TimingLogger(java.lang.String tag,
java.lang.String label)
tag - the log tag to use while logging the timingslabel - a string to be displayed with each logpublic void reset(java.lang.String tag,
java.lang.String label)
tag - the log tag to use while logging the timingslabel - a string to be displayed with each logpublic void reset()
public void addSplit(java.lang.String splitLabel)
splitLabel - a label to associate with this split.public void dumpToLog()