Package com.linkedin.venice.utils
Class LatencyUtils
- java.lang.Object
-
- com.linkedin.venice.utils.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
convertNSToMS(long nanoseconds)
static long
getElapsedTimeFromMsToMs(long startTimeInMs)
static double
getElapsedTimeFromNSToMS(long startTimeInNS)
static boolean
sleep(long millis)
Sleep until number of milliseconds have passed, or the operation is interrupted.
-
-
-
Method Detail
-
getElapsedTimeFromNSToMS
public static double getElapsedTimeFromNSToMS(long startTimeInNS)
- Parameters:
startTimeInNS
- input start time should use nanosecond unit- Returns:
- latency in millisecond
-
convertNSToMS
public static double convertNSToMS(long nanoseconds)
-
getElapsedTimeFromMsToMs
public static long getElapsedTimeFromMsToMs(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
-
-