org.jikesrvm.runtime
Class Time

java.lang.Object
  extended by org.jikesrvm.runtime.Time

public class Time
extends Object

Primitives from which to build interval and absolute timers.


Constructor Summary
Time()
           
 
Method Summary
static long currentTimeMillis()
          Time in milliseconds (epoch Jan 1 1970).
static long cycles()
          Return the value of a hardware cycle counter (RDTSC on IA32, time base register on PPC).
static double nanosToMillis(long c)
          Convert a long representing a time in nanoseconds into a double representing the same time in milliseconds.
static double nanosToSecs(long nanos)
           
static long nanoTime()
          Same semantics as java.lang.System.nanoTime(); This (or java.lang.System.nanoTime) is the preferred API for VM internal timing functions.
static long secsToNanos(double secs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Time

public Time()
Method Detail

nanosToMillis

public static double nanosToMillis(long c)
Convert a long representing a time in nanoseconds into a double representing the same time in milliseconds.

Parameters:
c - a time in nanoseconds
Returns:
c converted to milliseconds

cycles

public static long cycles()
Return the value of a hardware cycle counter (RDTSC on IA32, time base register on PPC). This is a very cheap, but also unreliable "timing" mechanism. There is absolutely no guarantee that the values returned from this method will either by monotonic (i.e., "time" can go backwards) or smooth ("time" can appear to move at a variable rate). This method should only be used for approximate timing in frequently executed code. We intentionally do not provide an API for converting from cycles to seconds because the conversion cannot be reliably supported on all of our platforms.


nanoTime

public static long nanoTime()
Same semantics as java.lang.System.nanoTime(); This (or java.lang.System.nanoTime) is the preferred API for VM internal timing functions.

Returns:
a monotonic timer value in nanoseconds.

currentTimeMillis

public static long currentTimeMillis()
Time in milliseconds (epoch Jan 1 1970).


nanosToSecs

public static double nanosToSecs(long nanos)

secsToNanos

public static long secsToNanos(double secs)