Class BinarySearchLatencyTracker

  • All Implemented Interfaces:
    ILatencyTracker

    public class BinarySearchLatencyTracker
    extends Object
    implements ILatencyTracker
    Tracks latencies pero bucket of time. Each bucket represent a latency greater than the one before and each number within each bucket is a number of calls in the range.

    (1) 1.00 (2) 1.50 (3) 2.25 (4) 3.38 (5) 5.06 (6) 7.59 (7) 11.39 (8) 17.09 (9) 25.63 (10) 38.44 (11) 57.67 (12) 86.50 (13) 129.75 (14) 194.62 (15) 291.93 (16) 437.89 (17) 656.84 (18) 985.26 (19) 1,477.89 (20) 2,216.84 (21) 3,325.26 (22) 4,987.89 (23) 7,481.83

    Thread-safety: This class is not thread safe.

    Created by patricioe on 2/10/16.

    • Constructor Detail

      • BinarySearchLatencyTracker

        public BinarySearchLatencyTracker()
    • Method Detail

      • addLatencyMillis

        public void addLatencyMillis​(long millis)
        Increment the internal counter for the bucket this latency falls into.
        Specified by:
        addLatencyMillis in interface ILatencyTracker
        Parameters:
        millis -
      • addLatencyMicros

        public void addLatencyMicros​(long micros)
        Increment the internal counter for the bucket this latency falls into.
        Specified by:
        addLatencyMicros in interface ILatencyTracker
        Parameters:
        micros -
      • getLatencies

        public long[] getLatencies()
        Returns the list of latencies buckets as an array.
        Specified by:
        getLatencies in interface ILatencyTracker
        Returns:
        the list of latencies buckets as an array.
      • getBucketForLatencyMillis

        public long getBucketForLatencyMillis​(long latency)
        Returns the counts in the bucket this latency falls into. The latencies will no be updated.
        Specified by:
        getBucketForLatencyMillis in interface ILatencyTracker
        Parameters:
        latency -
        Returns:
        the bucket content for the latency.
      • getBucketForLatencyMicros

        public long getBucketForLatencyMicros​(long latency)
        Returns the counts in the bucket this latency falls into. The latencies will no be updated.
        Specified by:
        getBucketForLatencyMicros in interface ILatencyTracker
        Parameters:
        latency -
        Returns:
        the bucket content for the latency.