Package com.linkedin.venice.utils
Class LatencyUtils
java.lang.Object
com.linkedin.venice.utils.LatencyUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Constructor Details
-
LatencyUtils
public LatencyUtils()
-
-
Method Details
-
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
-