public class MetricsCollector extends Object implements MetricsData
Constructor and Description |
---|
MetricsCollector(org.joda.time.Duration totalMetricDuration,
int maxEntries) |
Modifier and Type | Method and Description |
---|---|
void |
addValue(float value,
org.joda.time.DateTime now)
Adds a value to the collector.
|
void |
addValueNow(float value)
Adds a value to the collector.
|
static MetricsCollector |
create(MultiMetricsData.Period interval) |
float |
getAvg()
Return the average of all metric data added up until now since the duration (approx) of this metric.
|
int |
getCount()
Return the total number of metric data items added up until now since the duration (approx) of this metric.
|
float |
getMax()
Get maximum.
|
float |
getMin()
Get minimum.
|
List<MetricsTimeSlot> |
getSlots()
Retrieve the slots by which the metric is represented internally.
|
float |
getStdDev()
Get standard deviation.
|
float |
getSum()
Return the sum of all metric data added up until now since the duration (approx) of this metric.
|
org.joda.time.Duration |
getTotalMetricDuration() |
void |
setSlots(Collection<MetricsTimeSlot> slots)
Set the slots by which the metric is represented internally.
|
public MetricsCollector(@Nonnull org.joda.time.Duration totalMetricDuration, int maxEntries)
@Nonnull public static MetricsCollector create(@Nonnull MultiMetricsData.Period interval)
@Nonnull public List<MetricsTimeSlot> getSlots()
public void setSlots(@Nonnull Collection<MetricsTimeSlot> slots)
slots
- Metric slots.@Nonnull public org.joda.time.Duration getTotalMetricDuration()
public void addValueNow(float value)
value
- Value to add.public void addValue(float value, @Nonnull org.joda.time.DateTime now)
addValueNow(float)
when now is determined by the
caller and should be aligned with other now-related functionality. Note that now should denote the current time
and cannot be an arbitrary time in the past or the future.value
- Value to add.now
- Current time, as determined by the caller.public int getCount()
getCount
in interface MetricsData
public float getSum()
getSum
in interface MetricsData
public float getAvg()
getAvg
in interface MetricsData
Float.NaN
if no data has been added.public float getStdDev()
getStdDev
in interface MetricsData
Float.NaN
if no data has been added.public float getMax()
getMax
in interface MetricsData
Float.NaN
if no data has been added.public float getMin()
getMin
in interface MetricsData
Float.NaN
if no data has been added.Copyright © 2018 TomTom International BV. All rights reserved.