Class PerfStatsCollector

java.lang.Object
org.robolectric.util.PerfStatsCollector

public class PerfStatsCollector extends Object
Collects performance statistics for later reporting via PerfStatsReporter.
Since:
3.6
  • Constructor Details

    • PerfStatsCollector

      public PerfStatsCollector()
  • Method Details

    • getInstance

      public static PerfStatsCollector getInstance()
    • setEnabled

      public void setEnabled(boolean isEnabled)
      If not enabled, don't bother retaining perf stats, saving some memory and CPU cycles.
    • startEvent

      public PerfStatsCollector.Event startEvent(String eventName)
    • measure

      public <T, E extends Exception> T measure(String eventName, PerfStatsCollector.ThrowingSupplier<T,E> supplier) throws E
      Throws:
      E
    • incrementCount

      public void incrementCount(String eventName)
    • measure

      public <E extends Exception> void measure(String eventName, PerfStatsCollector.ThrowingRunnable<E> runnable) throws E
      Throws:
      E
    • getMetrics

      public Collection<org.robolectric.pluginapi.perf.Metric> getMetrics()
    • putMetadata

      public <T> void putMetadata(Class<T> metadataClass, T metadata)
    • getMetadata

      public org.robolectric.pluginapi.perf.Metadata getMetadata()
    • reset

      public void reset()