server.testmodules
Class TransferSpeedTest

java.lang.Object
  extended by server.framework.network.ServerSocketCommunicator
      extended by server.testmodules.TestModule
          extended by server.testmodules.TransferSpeedTest
All Implemented Interfaces:
Communicator

public class TransferSpeedTest
extends TestModule

This test module tests the transfer speed of the networks by sending packets with increasing sizes. When a set of packets has been sent, the size of the packets is increased with the amount specfied in the SIZE_INC variable. The test results from this test are calculated by finding the minimum, maximum and average transfer times for each size set, and calculating the transfer speed based on the average.

Author:
Martin Jarrett, Eivind Sorteberg

Nested Class Summary
 
Nested classes/interfaces inherited from class server.testmodules.TestModule
TestModule.Sender, TestModule.TestType, TestModule.Timer
 
Nested classes/interfaces inherited from class server.framework.network.ServerSocketCommunicator
ServerSocketCommunicator.ReceiverThread, ServerSocketCommunicator.SenderThread
 
Field Summary
static char ID_CHAR
           
static int INITIAL_SIZE
           
static int LATENCY_START
           
static int SIZE_INC
           
 
Fields inherited from class server.testmodules.TestModule
allTests, currentRun, interval, message, NETWORK, NOF_INTERVALS, NOF_PACKETS, NOF_RUNS, PROVIDER, random
 
Fields inherited from class server.framework.network.ServerSocketCommunicator
receiverThread, senderThread, server, socket
 
Constructor Summary
TransferSpeedTest(SocketWrapper socket, AbstractServer server)
          Creates a transfer speed test instance by calling the super constructor.
 
Method Summary
protected  java.lang.Number[] calculateValues(TestModule.Timer[] timers, int interval_no)
          Method that calculates the minimum, maximum and average transfer time for the specified interval number.
protected  java.lang.String findIdString(java.lang.String message)
          Extracts the id from the message by removing the x's and the '!'
protected  java.lang.String[] getHeaders()
          Gets the headers for the coloumns in the report.
protected  long getInitialInterval()
          Returns the intital send interval between the messages.
protected  java.lang.String getInitialMessage()
          Creates the initial message based on the INITIAL_SIZE value.
protected  java.lang.String getStringToSend(int id)
          Creates the string to send by appending the specified number of 'x' characters to the id and separator.
protected  java.lang.String getTitle()
          Gets the title for the report.
protected  void notifyAboutIntervalComplete()
          Called when one size set has been completed.
 
Methods inherited from class server.testmodules.TestModule
close, connect, disconnect, getAllValues, getId, getLastId, getReport, getThreeDigitString, getTimeInSeconds, notifyAboutMessageReceived, notifyAboutRunComplete, runTest, searchForNodes, sendMessage
 
Methods inherited from class server.framework.network.ServerSocketCommunicator
getSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_CHAR

public static final char ID_CHAR
See Also:
Constant Field Values

INITIAL_SIZE

public static final int INITIAL_SIZE
See Also:
Constant Field Values

SIZE_INC

public static final int SIZE_INC
See Also:
Constant Field Values

LATENCY_START

public static final int LATENCY_START
See Also:
Constant Field Values
Constructor Detail

TransferSpeedTest

public TransferSpeedTest(SocketWrapper socket,
                         AbstractServer server)
Creates a transfer speed test instance by calling the super constructor.

Parameters:
socket - The socket to use for the transmission.
server - The server model.
Method Detail

getHeaders

protected java.lang.String[] getHeaders()
Description copied from class: TestModule
Gets the headers for the coloumns in the report.

Specified by:
getHeaders in class TestModule
Returns:
The headers used for the HTML table generated by the test.

calculateValues

protected java.lang.Number[] calculateValues(TestModule.Timer[] timers,
                                             int interval_no)
Method that calculates the minimum, maximum and average transfer time for the specified interval number. The transfer speed is then calculated based on the average transfer time.

Specified by:
calculateValues in class TestModule
Parameters:
timers - The set of measured response times for each packet.
interval_no - The interval for which to calculate the values.
Returns:
The minimum, maximum and average response time.

getTitle

protected java.lang.String getTitle()
Description copied from class: TestModule
Gets the title for the report.

Specified by:
getTitle in class TestModule
Returns:
The title for the HTML file generated by the test.

notifyAboutIntervalComplete

protected void notifyAboutIntervalComplete()
Called when one size set has been completed. The size of the messages is then increased with the value specified in SIZE_INC, and the correct number of 'x' characters is added to the message to send.

Specified by:
notifyAboutIntervalComplete in class TestModule

getInitialInterval

protected long getInitialInterval()
Returns the intital send interval between the messages. This value is constant in this test and specified in LATENCY_START.

Specified by:
getInitialInterval in class TestModule
Returns:
LATENCY_START.

getInitialMessage

protected java.lang.String getInitialMessage()
Creates the initial message based on the INITIAL_SIZE value.

Specified by:
getInitialMessage in class TestModule
Returns:
The initial message to send.

getStringToSend

protected java.lang.String getStringToSend(int id)
Creates the string to send by appending the specified number of 'x' characters to the id and separator.

Specified by:
getStringToSend in class TestModule
Parameters:
id - The id of the message.
Returns:
A message on the form '!'{'x'}

findIdString

protected java.lang.String findIdString(java.lang.String message)
Extracts the id from the message by removing the x's and the '!' character.

Specified by:
findIdString in class TestModule
Parameters:
message - The message that was returned.
Returns:
The id of the message.