Class LongTreeTracker

java.lang.Object
io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTracker
Direct Known Subclasses:
LongTreeTrackerAtomic

public class LongTreeTracker extends Object

Using the 64 bit structure of a long as a heap addressed tracker, where the leaf nodes represent marked values and all others are used to consolidate state.

One bit is ignored, the 2s compliment sign, leaving 63 bits: 31 bits for root and path and 32 bits as leaf nodes.

Each time a leaf node is marked as complete, it's sibling is checked for the same. While both are marked, the same process is checked for its parent and its sibling, and so forth

This approach assumes that it is good to lower contention and retries for atomics when there are many threads active against the tracker. It should be benchmarked with simpler methods to see the complexity is worth it.

  • Constructor Details

    • LongTreeTracker

      public LongTreeTracker(long timage)
    • LongTreeTracker

      public LongTreeTracker()
  • Method Details

    • setCompleted

      public long setCompleted(long index, long image)
      Apply an index value between 0 and 31 inclusive. Return the accumulator. If all 32 slots of this tracker have been completed, the returned value will have LSB bit 2 set.
      Parameters:
      index - a long value between 0 and 31 to mark as complete
      image - the long value which serves as the starting state of the bit field
      Returns:
      the accumulator
    • setCompleted

      public long setCompleted(long index)
    • isCompleted

      public boolean isCompleted(long index)
    • isCompleted

      public boolean isCompleted()
    • getLowestCompleted

      public long getLowestCompleted()
      Returns:
      the lowest index isCycleCompleted, or -1 if none were isCycleCompleted
    • getHighestCompleted

      public long getHighestCompleted()
      Returns:
      the highest index isCycleCompleted, or -1 if none were isCycleCompleted
    • getTotalCompleted

      public long getTotalCompleted()
    • toBinaryString

      public static String toBinaryString(long bitfield)
    • toString

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

      public static String diagString(long bitfield)
    • getImage

      public long getImage()