se.lth.cs.realtime
Class RTSystem
java.lang.Object
se.lth.cs.realtime.RTSystem
- All Implemented Interfaces:
- RTSystemProperties
- public class RTSystem
- extends java.lang.Object
- implements RTSystemProperties
- See Also:
License
Method Summary |
static long |
currentTimeMillis()
Obtain current 'real' time. |
static int |
getDefaultEventBufferSize()
|
static int |
getMaxEventBufferSize()
|
static int |
getTickMillis()
|
static int |
getTickNanos()
|
static void |
sleep(long millis)
Causes the currently executing thread to sleep (temporarily cease
execution) for the specified number of milliseconds. |
static void |
sleep(long millis,
int nanos)
Causes the currently executing thread to sleep (cease execution)
for the specified number of milliseconds plus the specified number
of nanoseconds. |
static void |
sleepUntil(long wakeUpTime)
Causes the currently executing thread to sleep (temporarily cease
execution) until the specified moment in time. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RTSystem
public RTSystem()
getDefaultEventBufferSize
public static int getDefaultEventBufferSize()
- Returns:
- default generic buffer size.
getMaxEventBufferSize
public static int getMaxEventBufferSize()
- Returns:
- upper limit of buffer sizes.
getTickMillis
public static int getTickMillis()
- Returns:
- clock tick period in number of milli-seconds.
getTickNanos
public static int getTickNanos()
- Returns:
- clock tick period in number of nano-seconds.
currentTimeMillis
public static long currentTimeMillis()
- Obtain current 'real' time. If the JVM is not suspended (due to
breakpoints and the like), if priorities are strictly
considered for the scheduling, if deadlines are met, and if the
time-base is based on unscaled real time, the returned time
will be equal to
System.currentTimeMillis()
. For
any two subsequent calls (from any threads), the second call is
guaranteed to return a value greater than or equal to the value
returned from the first call. That is, the time never decreases.
- Returns:
- Real time adjusted with respect to platform or
debugging delays, permitting real-time programs to be tested
from a concurrency point of view using a JVM or OS not
providing real-time.
sleepUntil
public static void sleepUntil(long wakeUpTime)
throws RTInterrupted,
RTDelayed
- Causes the currently executing thread to sleep (temporarily cease
execution) until the specified moment in time.
Time is measured in milliseconds, starting from 00am, January 1st
1970, UTC. The thread does not lose ownership of any monitors.
- Parameters:
wakeUpTime
- the time to wake up.
- Throws:
RTInterrupted
- if another thread has interrupted this thread.
RTDelayed
- if execution continues more than
maxTimeLag
too late.
sleep
public static void sleep(long millis)
throws RTInterrupted,
RTDelayed
- Causes the currently executing thread to sleep (temporarily cease
execution) for the specified number of milliseconds. The thread
does not lose ownership of any monitors.
- Parameters:
millis
- the length of time to sleep in milliseconds.
- Throws:
java.lang.IllegalArgumentException
- if the value of millis is negative.
RTInterrupted
- if another thread has interrupted this thread.
RTDelayed
- if execution continues more than
maxTimeLag
too late.- See Also:
Thread.sleep(long)
sleep
public static void sleep(long millis,
int nanos)
throws RTInterrupted,
RTDelayed
- Causes the currently executing thread to sleep (cease execution)
for the specified number of milliseconds plus the specified number
of nanoseconds. The thread does not lose ownership of any monitors.
- Parameters:
millis
- the length of time to sleep in milliseconds.nanos
- 0-999999 additional nanoseconds to sleep.
- Throws:
java.lang.IllegalArgumentException
- if the value of millis is negative.
RTInterrupted
- if another thread has interrupted this thread.
RTDelayed
- if execution continues more than
maxTimeLag
too late.- See Also:
Thread.sleep(long, int)