public class PerfStatsCollector extends Object
Collects performance statistics for later reporting via PerfStatsReporter
.
Modifier and Type | Class and Description |
---|---|
class |
PerfStatsCollector.Event
Event for perf stats collection.
|
static interface |
PerfStatsCollector.ThrowingRunnable<F extends Exception>
Runnable that throws an exception.
|
static interface |
PerfStatsCollector.ThrowingSupplier<T,F extends Exception>
Supplier that throws an exception.
|
Constructor and Description |
---|
PerfStatsCollector() |
Modifier and Type | Method and Description |
---|---|
static PerfStatsCollector |
getInstance() |
Metadata |
getMetadata() |
Collection<Metric> |
getMetrics() |
<E extends Exception> |
measure(String eventName,
PerfStatsCollector.ThrowingRunnable<E> runnable) |
<T,E extends Exception> |
measure(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.
|
PerfStatsCollector.Event |
startEvent(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(String eventName)
public <T,E extends Exception> T measure(String eventName, PerfStatsCollector.ThrowingSupplier<T,E> supplier) throws E extends Exception
E extends Exception
public <E extends Exception> void measure(String eventName, PerfStatsCollector.ThrowingRunnable<E> runnable) throws E extends Exception
E extends Exception
public Collection<Metric> getMetrics()
public <T> void putMetadata(Class<T> metadataClass, T metadata)
public Metadata getMetadata()
public void reset()