Package org.robolectric.util
Class PerfStatsCollector
java.lang.Object
org.robolectric.util.PerfStatsCollector
Collects performance statistics for later reporting via
PerfStatsReporter
.- Since:
- 3.6
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Event for perf stats collection.static interface
Runnable that throws an exception.static interface
PerfStatsCollector.ThrowingSupplier<T,
F extends Exception> Supplier that throws an exception. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PerfStatsCollector
void
incrementCount
(String eventName) <E extends Exception>
voidmeasure
(String eventName, PerfStatsCollector.ThrowingRunnable<E> runnable) <T,
E extends Exception>
Tmeasure
(String eventName, PerfStatsCollector.ThrowingSupplier<T, E> supplier) <T> void
putMetadata
(Class<T> metadataClass, T metadata) void
reset()
void
setEnabled
(boolean isEnabled) If not enabled, don't bother retaining perf stats, saving some memory and CPU cycles.startEvent
(String eventName)
-
Constructor Details
-
PerfStatsCollector
public PerfStatsCollector()
-
-
Method Details
-
getInstance
-
setEnabled
public void setEnabled(boolean isEnabled) If not enabled, don't bother retaining perf stats, saving some memory and CPU cycles. -
startEvent
-
measure
public <T,E extends Exception> T measure(String eventName, PerfStatsCollector.ThrowingSupplier<T, E> supplier) throws E- Throws:
E extends Exception
-
incrementCount
-
measure
public <E extends Exception> void measure(String eventName, PerfStatsCollector.ThrowingRunnable<E> runnable) throws E - Throws:
E extends Exception
-
getMetrics
-
putMetadata
-
getMetadata
-
reset
public void reset()
-