public class PerfStatsCollector
extends java.lang.Object
Collects performance statistics for later reporting via PerfStatsReporter
.
Modifier and Type | Class and Description |
---|---|
class |
PerfStatsCollector.Event
Event for perf stats collection.
|
static class |
PerfStatsCollector.Metadata
Metadata for perf stats collection.
|
static class |
PerfStatsCollector.Metric
Metric for perf stats collection.
|
static interface |
PerfStatsCollector.ThrowingRunnable<F extends java.lang.Exception>
Runnable that throws an exception.
|
static interface |
PerfStatsCollector.ThrowingSupplier<T,F extends java.lang.Exception>
Supplier that throws an exception.
|
Constructor and Description |
---|
PerfStatsCollector() |
Modifier and Type | Method and Description |
---|---|
static PerfStatsCollector |
getInstance() |
PerfStatsCollector.Metadata |
getMetadata() |
java.util.Collection<PerfStatsCollector.Metric> |
getMetrics() |
<E extends java.lang.Exception> |
measure(java.lang.String eventName,
PerfStatsCollector.ThrowingRunnable<E> runnable) |
<T,E extends java.lang.Exception> |
measure(java.lang.String eventName,
PerfStatsCollector.ThrowingSupplier<T,E> supplier) |
<T> void |
putMetadata(java.lang.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.
|
PerfStatsCollector.Event |
startEvent(java.lang.String eventName) |
public static PerfStatsCollector getInstance()
public void setEnabled(boolean isEnabled)
If not enabled, don’t bother retaining perf stats, saving some memory and CPU cycles.
public PerfStatsCollector.Event startEvent(java.lang.String eventName)
public <T,E extends java.lang.Exception> T measure(java.lang.String eventName, PerfStatsCollector.ThrowingSupplier<T,E> supplier) throws E extends java.lang.Exception
E extends java.lang.Exception
public <E extends java.lang.Exception> void measure(java.lang.String eventName, PerfStatsCollector.ThrowingRunnable<E> runnable) throws E extends java.lang.Exception
E extends java.lang.Exception
public java.util.Collection<PerfStatsCollector.Metric> getMetrics()
public <T> void putMetadata(java.lang.Class<T> metadataClass, T metadata)
public PerfStatsCollector.Metadata getMetadata()
public void reset()