Class DeltaHdrHistogramReservoir

java.lang.Object
io.nosqlbench.nb.api.engine.metrics.DeltaHdrHistogramReservoir
All Implemented Interfaces:
com.codahale.metrics.Reservoir, NBLabeledElement

public final class DeltaHdrHistogramReservoir extends Object implements com.codahale.metrics.Reservoir, NBLabeledElement
A custom wrapping of snapshotting logic on the HdrHistogram. This histogram will always report the last histogram since it was most recently asked for with the getDeltaSnapshot(...) method. This provides local snapshot timing, but with a consistent view for reporting channels about what those snapshots most recently looked like.

This implementation also supports attaching a single log writer. If a log writer is attached, each time an interval is snapshotted internally, the data will also be written to an hdr log via the writer.

  • Constructor Details

    • DeltaHdrHistogramReservoir

      public DeltaHdrHistogramReservoir(NBLabels labels, int significantDigits)
      Create a reservoir with a default recorder. This recorder should be suitable for most usage.
      Parameters:
      labels - the labels to give to the reservoir, for logging purposes
      significantDigits - how many significant digits to track in the reservoir
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface com.codahale.metrics.Reservoir
    • update

      public void update(long value)
      Specified by:
      update in interface com.codahale.metrics.Reservoir
    • getSnapshot

      public com.codahale.metrics.Snapshot getSnapshot()
      Specified by:
      getSnapshot in interface com.codahale.metrics.Reservoir
      Returns:
      the data accumulated since the reservoir was created, or since the last call to this method
    • getNextHdrHistogram

      public org.HdrHistogram.Histogram getNextHdrHistogram()
    • getLastSnapshot

      public com.codahale.metrics.Snapshot getLastSnapshot()
      Returns:
      last histogram snapshot that was provided by getSnapshot()
    • write

      public void write(org.HdrHistogram.HistogramLogWriter writer)
      Write the last results via the log writer.
      Parameters:
      writer - the log writer to use
    • copySettings

      public DeltaHdrHistogramReservoir copySettings()
    • attachLogWriter

      public void attachLogWriter(org.HdrHistogram.HistogramLogWriter logWriter)
    • getLastHistogram

      public org.HdrHistogram.Histogram getLastHistogram()
    • getLabels

      public NBLabels getLabels()
      Specified by:
      getLabels in interface NBLabeledElement