Package com.decs.application.services
Class Timer
java.lang.Object
com.decs.application.services.Timer
Timer Class
This class handles time measurements in the system's execution environment (Java Virtual Machine)
- Version:
- 1.0
- Author:
- Bruno Guiomar
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcomputeTime(long initial, long finish) Computes the elapsed wall-clock time between two instantsstatic longgetCPUTimestamp(ThreadMXBean threadMXBean) static longstatic longnano2milis(long value) Converts a value expressed in nanoseconds to millisecondsstatic longnano2seconds(long value) Converts a value expressed in nanoseconds to seconds
-
Field Details
-
threadMXBean
-
-
Constructor Details
-
Timer
public Timer()Class Constructor
-
-
Method Details
-
computeTime
public static long computeTime(long initial, long finish) Computes the elapsed wall-clock time between two instants- Parameters:
initial- Initial instantfinish- Final instant- Returns:
- Elapsed wall-clock time between the final and initial instants
-
getWallClockTimestamp
public static long getWallClockTimestamp()- Returns:
- Wall-clock timestamp in nanoseconds
-
getCPUTimestamp
- Parameters:
threadMXBean- Management interface object for the thread system of the JVM- Returns:
- CPU timestamp in nanoseconds
-
nano2milis
public static long nano2milis(long value) Converts a value expressed in nanoseconds to milliseconds- Parameters:
value- Value in nanoseconds- Returns:
- Value in milliseconds
-
nano2seconds
public static long nano2seconds(long value) Converts a value expressed in nanoseconds to seconds- Parameters:
value- Value in nanoseconds- Returns:
- Value in seconds
-