|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.qpid.test.framework.clocksynch.UDPClockSynchronizer
public class UDPClockSynchronizer
UDPClockSynchronizer is a ClockSynchronizer
that sends pings as UDP datagrams, and uses the following simple
algorithm to perform clock synchronization:
Responsibilities | Collaborations |
---|---|
Trigger a clock synchronziation. | |
Compute a clock delta to apply to the local clock. | |
Estimate the error in the synchronzation. |
Constructor Summary | |
---|---|
UDPClockSynchronizer(String address)
Creates a clock synchronizer against the specified address for the reference. |
Method Summary | |
---|---|
long |
getDelta()
Gets the clock delta in nano seconds. |
long |
getEpsilon()
Gets an estimate of the clock error in nan seconds. |
static void |
main(String[] args)
For testing purposes. |
static long |
mean(long[] values)
Computes the mean of a series of values. |
static long |
median(long[] values)
Computes the median of a series of values. |
long |
nanoTime()
Gets the local clock time with any computed delta added in. |
protected long |
ping()
Performs a single reference clock request cycle and returns the estimated delta relative to the local clock. |
static long |
standardDeviation(long[] values)
Computes the standard deviation of a series of values. |
void |
synch()
The slave side should call this to compute a clock delta with the reference. |
protected void |
synch(int n)
Updates the synchronization delta by performing the specified number of reference clock requests. |
static long |
variance(long[] values)
Computes the variance of series of values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UDPClockSynchronizer(String address)
address
- The address of the reference service.Method Detail |
---|
public void synch() throws ClockSynchFailureException
synch
in interface ClockSynchronizer
ClockSynchFailureException
- If synchronization cannot be achieved, due to unavailability of the reference
time service.protected void synch(int n) throws ClockSynchFailureException
n
- The number of reference clock request cycles to perform.
ClockSynchFailureException
- If synchronization cannot be achieved, due to unavailability of the reference
time service.protected long ping() throws ClockSynchFailureException
ClockSynchFailureException
- If the reference service is not responding.public long getDelta()
getDelta
in interface ClockSynchronizer
public long getEpsilon()
getEpsilon
in interface ClockSynchronizer
public long nanoTime()
nanoTime
in interface ClockSynchronizer
public static long median(long[] values)
values
- The values.
public static long mean(long[] values)
values
- The values.
public static long variance(long[] values)
values
- The values.
public static long standardDeviation(long[] values)
values
- The values.
public static void main(String[] args)
args
- Address of reference clock as arg 1.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |