Class MutableMetrics
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics
-
- org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Metrics
public class MutableMetrics extends ImmutableMetrics implements Cloneable
AMetrics
implementation that can be modified.- Author:
- Bob Briody (http://bobbriody.com), Stephen Mallette (http://stephen.genoprime.com)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics
annotations, counts, durationNs, id, name, nested
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MutableMetrics()
MutableMetrics(String id, String name)
MutableMetrics(Metrics other)
Create aMutableMetrics
from an immutable one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 throughTraversalMetrics
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.-
Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics
getAnnotation, getAnnotations, getCount, getCounts, getDuration, getId, getName, getNested, toString
-
-
-
-
Method Detail
-
addNested
public void addNested(MutableMetrics metrics)
-
start
public void start()
Starts the timer for this metric. Should not be called again without first callingstop()
.
-
stop
public void stop()
Stops the timer for this metric and increments the overall duration. Should not be called without first callingstart()
.
-
incrementCount
public void incrementCount(String key, long incr)
Increments a count metric.
-
setDuration
public void setDuration(long dur, TimeUnit unit)
Directly set the duration for the metric.
-
setCount
public void setCount(String key, long val)
Directly set the count for the metric.
-
aggregate
public void aggregate(MutableMetrics other)
Aggregate one set of metrics into the current body of metrics.
-
setAnnotation
public void setAnnotation(String key, Object value)
Set an annotation value. Support exists for Strings and Numbers only. During a merge, Strings are concatenated into a "," (comma) separated list of distinct values (duplicates are ignored), and Numbers are summed.
-
getNested
public MutableMetrics getNested(String metricsId)
Description copied from interface:Metrics
Get a nested Metrics object by Id.- Specified by:
getNested
in interfaceMetrics
- Overrides:
getNested
in classImmutableMetrics
- Returns:
- a nested Metrics object.
-
isFinalized
public boolean isFinalized()
Once these metrics are used in computing the final metrics to report throughTraversalMetrics
they should no longer be modified and are thus finalized.
-
getImmutableClone
public ImmutableMetrics getImmutableClone()
Gets a copy of the metrics that is immutable. Once this clone is made, theMutableMetrics
can no longer be modified themselves. This prevents custom steps that implementProfiling
from adding to the metrics after the traversal is complete.
-
copyMembers
protected void copyMembers(ImmutableMetrics clone)
-
clone
public MutableMetrics clone()
-
finish
public void finish(long bulk)
-
-