simnet
Class SpeedTest

java.lang.Object
  extended byjava.lang.Thread
      extended bysimnet.Application
          extended bysimnet.SpeedTest
All Implemented Interfaces:
Pluggable, PlugoutListener, java.lang.Runnable, SimnetWindowListener

public class SpeedTest
extends Application
implements Pluggable

An application that is used to test how well bandwidth and latency are modelled.


Nested Class Summary
(package private)  class SpeedTest.STThread
          Inner class used to send out packets for a SpeedTest.
 
Field Summary
protected static Histogram hist
           
protected  boolean keep_going
           
(package private)  DatagramSocket sock
           
static int SpeedTestPort
          Which port to run the speed test on.
protected static int st_left
           
protected  java.lang.Thread test_thread
           
 
Fields inherited from class simnet.Application
appid, appstart, frame, initialized, node, NODE_ID, pid, random, sim, win
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SpeedTest()
           
 
Method Summary
 void customInit()
          Create a UDP socket and bind it to the speed test port.
 boolean prePlugout(java.lang.Object replacement)
          If a test is currently running from this application, stop it.
 void run()
          Receive speed test packets, and record them.
 void SpeedTest(java.lang.Integer rounds, java.lang.Integer delay)
          Run a speed test for the specified number of rounds, with the specified delay between rounds.
 void SpeedTest(java.lang.Integer rounds, java.lang.Integer delay, java.lang.Integer stagger)
          Run a speed test for the specified number of rounds, with the specified delay between rounds.
 void SpeedTest(java.lang.String all, java.lang.Integer rounds, java.lang.Integer delay)
          Run a speed test with the specified parameters, and a stagger of 0.
 void SpeedTest(java.lang.String all, java.lang.Integer rounds, java.lang.Integer delay, java.lang.Integer stagger)
          Run a speed test for the specified number of rounds with delay between each round.
 void SpeedTestResults()
          Print out the results of a speed test, waiting for it to finish, if necessary.
 
Methods inherited from class simnet.Application
closeWindow, finalize, getTitleString, initialize, plugoutNotification, printout, printout, processWindowCommand, rawOut, window
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SpeedTestPort

public static final int SpeedTestPort
Which port to run the speed test on.

See Also:
Constant Field Values

sock

DatagramSocket sock

keep_going

protected transient boolean keep_going

st_left

protected static int st_left

hist

protected static Histogram hist

test_thread

protected transient java.lang.Thread test_thread
Constructor Detail

SpeedTest

public SpeedTest()
Method Detail

customInit

public void customInit()
Create a UDP socket and bind it to the speed test port.

Overrides:
customInit in class Application

SpeedTestResults

public void SpeedTestResults()
Print out the results of a speed test, waiting for it to finish, if necessary.


SpeedTest

public void SpeedTest(java.lang.String all,
                      java.lang.Integer rounds,
                      java.lang.Integer delay)
Run a speed test with the specified parameters, and a stagger of 0.


SpeedTest

public void SpeedTest(java.lang.String all,
                      java.lang.Integer rounds,
                      java.lang.Integer delay,
                      java.lang.Integer stagger)
Run a speed test for the specified number of rounds with delay between each round. A delay of stagger will be between each packet. In each round, a packet will be sent to every other node. If all is "all", the speed test will be run at all nodes, otherwise, it will just be run on this node.


SpeedTest

public void SpeedTest(java.lang.Integer rounds,
                      java.lang.Integer delay)
Run a speed test for the specified number of rounds, with the specified delay between rounds. Between sending packets to each destination, there will be an additional delay of stagger ms. A stagger of 0 will be used if no stagger is specified.


SpeedTest

public void SpeedTest(java.lang.Integer rounds,
                      java.lang.Integer delay,
                      java.lang.Integer stagger)
Run a speed test for the specified number of rounds, with the specified delay between rounds. Between sending packets to each destination, there will be an additional delay of stagger ms.


run

public void run()
Receive speed test packets, and record them.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class Application

prePlugout

public boolean prePlugout(java.lang.Object replacement)
If a test is currently running from this application, stop it. This is somewhat motivated by the fact that we can't exactly copy our speed test thread over to a new application.

Specified by:
prePlugout in interface Pluggable
Returns:
if this object can now be removed (was the operation sucessful)