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(TimeService timeService)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLocalValue(ExtendedStatistic stat, double value)
Adds a value to a local statistic.void
addRemoteValue(ExtendedStatistic stat, double value)
Adds a value to a remote statistic.static double
convertNanosToMicro(double nanos)
static double
convertNanosToSeconds(double nanos)
void
dumpTo(PrintWriter writer)
Prints the cache statistics values to aPrintStream
.void
dumpTo(StringBuilder builder)
Dumps all the cache statistic values to aStringBuilder
double
getAttribute(ExtendedStatistic stat)
double
getPercentile(PercentileStatistic stat, int percentile)
void
merge(TransactionStatistics transactionStatistics)
Merges a transaction statistics in this cache statistics.void
reset()
reset all the statistics collected so far.
-
-
-
Constructor Detail
-
CacheStatisticCollector
public CacheStatisticCollector(TimeService timeService)
-
-
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.
-
-