Class SimFrameCapture

java.lang.Object
io.nosqlbench.scenarios.simframe.capture.SimFrameCapture
All Implemented Interfaces:
SimFrameResults
Direct Known Subclasses:
SimFrameValueData

public class SimFrameCapture extends Object implements SimFrameResults
This is a helper class that makes it easy to bundle up a combination of measurable factors and get a windowed sample from them. To use it, add your named data sources with their coefficients, and optionally a frameStartCallback which resets the measurement buffers for the next time. When you call getValue(), all callbacks are used after the value computation is complete.

This is NOT thread safe!

  • Constructor Details

    • SimFrameCapture

      public SimFrameCapture()
  • Method Details

    • awaitSteadyState

      public void awaitSteadyState()
    • addDirect

      public void addDirect(String name, DoubleSupplier supplier, double weight)
      Direct values are simply measured at the end of a frame.
      Parameters:
      name - measure name
      supplier - source of measurement
      weight - coefficient of weight for this measure
    • addDeltaTime

      public void addDeltaTime(String name, DoubleSupplier supplier, double weight, Runnable callback)
    • addDeltaTime

      public void addDeltaTime(String name, DoubleSupplier supplier, double weight)
    • addDeltaTime

      public void addDeltaTime(String name, LongSupplier supplier, double weight)
      Delta Time values are taken as the differential of the first and last values with respect to time passing.
      Parameters:
      name -
      supplier -
      weight -
    • addRemix

      public void addRemix(String name, ToDoubleFunction<BasisValues> remix, double weight, Runnable callback)
      A remix function takes as its input the computed raw values of the other functions, irrespective of their weights or weighting functions. At the end of a frame, each defined value is computed in the order it was added for capture and then added to the results view, where it can be referenced by subsequent functions. Thus, any remix values must be added after those value on which it depends.
      Parameters:
      name - The name of the remix value
      remix - A function which relies on previously computed raw values.
      weight - The weight to apply to the samples of this value for the final frame sample value.
      callback - An optional callback to invoke when the frame starts
    • addRemix

      public void addRemix(String name, ToDoubleFunction<BasisValues> remix, double weight)
    • history

      public List<FrameSampleSet> history()
      Specified by:
      history in interface SimFrameResults
    • getValue

      public double getValue()
      Specified by:
      getValue in interface SimFrameResults
    • size

      public int size()
      Specified by:
      size in interface SimFrameResults
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • startWindow

      public void startWindow()
    • restartWindow

      public void restartWindow()
    • restartWindow

      public void restartWindow(long now)
    • startWindow

      public void startWindow(long now)
    • stopWindow

      public void stopWindow()
    • stopWindow

      public void stopWindow(long now)
    • last

      public FrameSampleSet last()
    • addRemix

      public void addRemix(String name, ToDoubleFunction<BasisValues> remix)
    • activeSample

      public FrameSampleSet activeSample()