public class MutableMetrics extends ImmutableMetrics implements Cloneable
Metrics implementation that can be modified.annotations, counts, durationNs, id, name, nested| Modifier | Constructor and Description |
|---|---|
protected |
MutableMetrics() |
|
MutableMetrics(Metrics other)
Create a
MutableMetrics from an immutable one. |
|
MutableMetrics(String id,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNested(MutableMetrics metrics) |
void |
aggregate(MutableMetrics other)
Aggregate one set of metrics into the current body of metrics.
|
MutableMetrics |
clone() |
protected void |
copyMembers(ImmutableMetrics clone) |
void |
finish(long bulk) |
ImmutableMetrics |
getImmutableClone()
Gets a copy of the metrics that is immutable.
|
MutableMetrics |
getNested(String metricsId)
Get a nested Metrics object by Id.
|
void |
incrementCount(String key,
long incr)
Increments a count metric.
|
boolean |
isFinalized()
Once these metrics are used in computing the final metrics to report through
TraversalMetrics they
should no longer be modified and are thus finalized. |
void |
setAnnotation(String key,
Object value)
Set an annotation value.
|
void |
setCount(String key,
long val)
Directly set the count for the metric.
|
void |
setDuration(long dur,
TimeUnit unit)
Directly set the duration for the metric.
|
void |
start()
Starts the timer for this metric.
|
void |
stop()
Stops the timer for this metric and increments the overall duration.
|
getAnnotation, getAnnotations, getCount, getCounts, getDuration, getId, getName, getNested, toStringprotected MutableMetrics()
public MutableMetrics(Metrics other)
MutableMetrics from an immutable one.public void addNested(MutableMetrics metrics)
public void start()
stop().public void stop()
start().public void incrementCount(String key, long incr)
public void setDuration(long dur,
TimeUnit unit)
public void setCount(String key, long val)
public void aggregate(MutableMetrics other)
public void setAnnotation(String key, Object value)
public MutableMetrics getNested(String metricsId)
MetricsgetNested in interface MetricsgetNested in class ImmutableMetricspublic boolean isFinalized()
TraversalMetrics they
should no longer be modified and are thus finalized.public ImmutableMetrics getImmutableClone()
MutableMetrics can no
longer be modified themselves. This prevents custom steps that implement Profiling from adding to
the metrics after the traversal is complete.protected void copyMembers(ImmutableMetrics clone)
public MutableMetrics clone()
public void finish(long bulk)
Copyright © 2013–2017 Apache Software Foundation. All rights reserved.