Class LatencyUtils


  • public class LatencyUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      LatencyUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double convertLatencyFromNSToMS​(long latencyInNS)  
      static long getElapsedTimeInMs​(long startTimeInMs)  
      static double getLatencyInMS​(long startTimeInNS)  
      static boolean sleep​(long millis)
      Sleep until number of milliseconds have passed, or the operation is interrupted.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LatencyUtils

        public LatencyUtils()
    • Method Detail

      • getLatencyInMS

        public static double getLatencyInMS​(long startTimeInNS)
        Parameters:
        startTimeInNS - input start time should use nanosecond unit
        Returns:
        latency in millisecond
      • convertLatencyFromNSToMS

        public static double convertLatencyFromNSToMS​(long latencyInNS)
      • getElapsedTimeInMs

        public static long getElapsedTimeInMs​(long startTimeInMs)
        Parameters:
        startTimeInMs - input start time should use millisecond unit
        Returns:
        elapsed time in millisecond
      • sleep

        public static boolean sleep​(long millis)
        Sleep until number of milliseconds have passed, or the operation is interrupted. This method will swallow the InterruptedException and terminate, if this is used in a loop it may become difficult to cleanly break out of the loop.
        Parameters:
        millis -
        Returns:
        true on success and false if sleep was interrupted