Package org.infinispan.stats
Class CacheStatisticCollector
- java.lang.Object
-
- org.infinispan.stats.CacheStatisticCollector
-
public class CacheStatisticCollector extends Object
Collects and maintains all the statistics for a cache.- Since:
- 6.0
- Author:
- Roberto Palmieri, Sebastiano Peluso, Diego Didona, Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description CacheStatisticCollector(org.infinispan.commons.time.TimeService timeService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLocalValue(ExtendedStatistic stat, double value)Adds a value to a local statistic.voidaddRemoteValue(ExtendedStatistic stat, double value)Adds a value to a remote statistic.static doubleconvertNanosToMicro(double nanos)static doubleconvertNanosToSeconds(double nanos)voiddumpTo(PrintWriter writer)Prints the cache statistics values to aPrintStream.voiddumpTo(StringBuilder builder)Dumps all the cache statistic values to aStringBuilderdoublegetAttribute(ExtendedStatistic stat)doublegetPercentile(PercentileStatistic stat, int percentile)voidmerge(TransactionStatistics transactionStatistics)Merges a transaction statistics in this cache statistics.voidreset()reset all the statistics collected so far.
-
-
-
Method Detail
-
reset
public final void reset()
reset all the statistics collected so far.
-
merge
public final void merge(TransactionStatistics transactionStatistics)
Merges a transaction statistics in this cache statistics.
-
addLocalValue
public final void addLocalValue(ExtendedStatistic stat, double value)
Adds a value to a local statistic. This value is not associated with any transaction.
-
addRemoteValue
public final void addRemoteValue(ExtendedStatistic stat, double value)
Adds a value to a remote statistic. This value is not associated with any transaction.
-
getPercentile
public final double getPercentile(PercentileStatistic stat, int percentile) throws IllegalArgumentException
- Returns:
- the percentile og the statistic.
- Throws:
IllegalArgumentException- if the percentile request is not in the correct bounds (]0,100[)
-
getAttribute
public final double getAttribute(ExtendedStatistic stat) throws ExtendedStatisticNotFoundException
- Returns:
- the current value of the statistic. If the statistic is not exported (via JMX), then the sum of the remote and local value is returned.
- Throws:
ExtendedStatisticNotFoundException- if the statistic is not found.
-
dumpTo
public final void dumpTo(StringBuilder builder)
Dumps all the cache statistic values to aStringBuilder
-
dumpTo
public final void dumpTo(PrintWriter writer)
Prints the cache statistics values to aPrintStream.
-
convertNanosToMicro
public static double convertNanosToMicro(double nanos)
- Returns:
- the conversion of nanoseconds to microseconds without losing precision.
-
convertNanosToSeconds
public static double convertNanosToSeconds(double nanos)
- Returns:
- the conversion of nanoseconds to seconds without losing precision.
-
-