|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.croftsoft.core.util.loop.NanoTimeLoopGovernor
public final class NanoTimeLoopGovernor
Uses System nanoTime() to measure time between calls.
| Constructor Summary | |
|---|---|
NanoTimeLoopGovernor()
Initializes with a periodNanos of zero (maximum frequency). |
|
NanoTimeLoopGovernor(double frequency)
Constructs a LoopGovernor with the specified target frequency. |
|
| Method Summary | |
|---|---|
void |
govern()
This method puts the Thread to sleep for a limited time. |
static void |
main(String[] args)
Test method. |
void |
setFrequency(double frequency)
If the frequency is set to Double.POSITIVE_INFINITY, periodNanos will be set to zero. |
void |
setPeriodNanos(long periodNanos)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NanoTimeLoopGovernor(double frequency)
frequency - The targeted loop frequency in loops per second.public NanoTimeLoopGovernor()
| Method Detail |
|---|
public static void main(String[] args)
throws Exception
Exceptionpublic void setFrequency(double frequency)
public void setPeriodNanos(long periodNanos)
public void govern()
throws InterruptedException
LoopGovernor
govern in interface LoopGovernorInterruptedException
|
CroftSoft Javadoc | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||