Class CacheStatisticCollector

java.lang.Object
org.infinispan.extendedstats.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 Details

    • CacheStatisticCollector

      public CacheStatisticCollector(TimeService timeService)
  • Method Details

    • 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 a StringBuilder
    • dumpTo

      public final void dumpTo(PrintWriter writer)
      Prints the cache statistics values to a PrintStream.
    • 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.