Class HitRateMetric
- java.lang.Object
-
- org.apache.ignite.internal.processors.metric.AbstractMetric
-
- org.apache.ignite.internal.processors.metric.impl.HitRateMetric
-
- All Implemented Interfaces:
LongMetric,Metric
public class HitRateMetric extends AbstractMetric implements LongMetric
Accumulates approximate hit rate statistics. Calculates number of hits in lastrateTimeIntervalmilliseconds. Algorithm is based on circular array ofsizehit counters, each is responsible for last corresponding time interval ofrateTimeInterval/sizemilliseconds. Resulting number of hits is sum of all counters.Implementation is nonblocking and protected from hits loss. Maximum relative error is 1/
size. 2^55 - 1 hits per interval can be accumulated without numeric overflow.
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_SIZEDefault counters array size.
-
Constructor Summary
Constructors Constructor Description HitRateMetric(String name, @Nullable String desc, long rateTimeInterval, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long x)Adds x to the metric.voidincrement()Adds 1 to the metric.longrateTimeInterval()voidreset()Resets metric state.voidreset(long rateTimeInterval)Resets metric with the new parametes.voidreset(long rateTimeInterval, int size)Resets metric with the new parameters.longvalue()-
Methods inherited from class org.apache.ignite.internal.processors.metric.AbstractMetric
description, equals, hashCode, name
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.spi.metric.LongMetric
getAsString
-
Methods inherited from interface org.apache.ignite.spi.metric.Metric
description, name
-
-
-
-
Field Detail
-
DFLT_SIZE
public static final int DFLT_SIZE
Default counters array size.- See Also:
- Constant Field Values
-
-
Method Detail
-
reset
public void reset(long rateTimeInterval)
Resets metric with the new parametes.- Parameters:
rateTimeInterval- New rate time interval.
-
reset
public void reset(long rateTimeInterval, int size)Resets metric with the new parameters.- Parameters:
rateTimeInterval- New rate time interval.size- New counters array size.
-
add
public void add(long x)
Adds x to the metric.- Parameters:
x- Value to be added.
-
increment
public void increment()
Adds 1 to the metric.
-
value
public long value()
- Specified by:
valuein interfaceLongMetric- Returns:
- Value of the metric.
-
rateTimeInterval
public long rateTimeInterval()
- Returns:
- Rate time interval in milliseconds.
-
-