cgl.narada.performance
Class PerformanceMeasurement

java.lang.Object
  extended by cgl.narada.performance.PerformanceMeasurement

public class PerformanceMeasurement
extends Object

A module that notifies subscribers when there is network performance data to be sent and interpret results passed back from those subscribers. It contains 1 thread which will notify subscribers when measurement data needs to be send. Currently it will measure round trip latency, jitter, throughput, and messages/ second. To get the values, getStats() will return a StatCollection instance with the following metrics: :jitter :latency :throughput - Estimated maximum throughput for the link. : - User specified per second metrics. Configuration Parameters: (a) Measurement % (b) Min Status Interval (c) Max Status Interval

Version:
1.0

Constructor Summary
PerformanceMeasurement(LinkManager manager)
          ------------------------------------------------------------------------ Create a default performance Measurement module with 100 samples database per metric.
 
Method Summary
 void addMeasurementListener(PerformanceMeasurementListener l)
          ------------------------------------------------------------------------ Add a subscriber to the performance measurement service.
 long getMaxStatusInterval()
          ------------------------------------------------------------------------
 long getMinStatusInterval()
          ------------------------------------------------------------------------
 Vector getResponse(String subscriberName, byte[] measurementMessage)
          ------------------------------------------------------------------------ This method should be invoked whenever the transport/measurement subscriber receives a measurement message that was sent out via the PerformanceMeasurementListener.performanceMessagesAvailable().
 Vector getSamples(String subscriberName, String metric, int numSamples)
          ------------------------------------------------------------------------
 double getStat(String subscriberName, String metric, int numSamples, byte type)
          ------------------------------------------------------------------------
 double getStat(String subscriberName, String metric, long starttime, long endtime, byte type)
          ------------------------------------------------------------------------
 StatCollection getStatCollection()
          ------------------------------------------------------------------------
 void interpretResults(String subscriberName, byte[] results)
          ------------------------------------------------------------------------ This method should be invoked when the measurement sender receives a response message from other side.
 void removeMeasurementListener(PerformanceMeasurementListener l)
          ------------------------------------------------------------------------
 void setMaxStatusInterval(long interval)
          ------------------------------------------------------------------------
 void setMinStatusInterval(long interval)
          ------------------------------------------------------------------------
 void setSampleBuffer(int numSamples)
          ------------------------------------------------------------------------
 void setWebInterfacePort(int port)
          ------------------------------------------------------------------------ Sets the web display port.
 void start()
          ------------------------------------------------------------------------ Start the periodic measurement service.
 void stop()
          ------------------------------------------------------------------------ Stop the periodic measurement service.
 void updatePSMetric(String subscriberName, String metricName, double value)
          ------------------------------------------------------------------------ This will track X values / second type of metric.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceMeasurement

public PerformanceMeasurement(LinkManager manager)
------------------------------------------------------------------------ Create a default performance Measurement module with 100 samples database per metric.

Method Detail

setWebInterfacePort

public void setWebInterfacePort(int port)
------------------------------------------------------------------------ Sets the web display port. Default is 8080


getMinStatusInterval

public long getMinStatusInterval()
------------------------------------------------------------------------


setMinStatusInterval

public void setMinStatusInterval(long interval)
------------------------------------------------------------------------


getMaxStatusInterval

public long getMaxStatusInterval()
------------------------------------------------------------------------


setMaxStatusInterval

public void setMaxStatusInterval(long interval)
------------------------------------------------------------------------


getStatCollection

public StatCollection getStatCollection()
------------------------------------------------------------------------

Returns:
The statistics collection.

getStat

public double getStat(String subscriberName,
                      String metric,
                      int numSamples,
                      byte type)
------------------------------------------------------------------------


getSamples

public Vector getSamples(String subscriberName,
                         String metric,
                         int numSamples)
------------------------------------------------------------------------


getStat

public double getStat(String subscriberName,
                      String metric,
                      long starttime,
                      long endtime,
                      byte type)
------------------------------------------------------------------------


setSampleBuffer

public void setSampleBuffer(int numSamples)
------------------------------------------------------------------------

Parameters:
numSamples - The max number of samples in the database.

start

public void start()
------------------------------------------------------------------------ Start the periodic measurement service.


stop

public void stop()
------------------------------------------------------------------------ Stop the periodic measurement service.


updatePSMetric

public void updatePSMetric(String subscriberName,
                           String metricName,
                           double value)
------------------------------------------------------------------------ This will track X values / second type of metric. Invoke this function everytime there is a change the value. The time range will be calculated from the first time this method is called for a particular subscriberName/ metricName combination to the current measured time.

Parameters:
subscriberName - A unique subscriber name equal to PerformanceMeasurementListener.getName();
metricName - The name of the metric ("msg/second", ...)
value - The value to update the total with (will do += )

getResponse

public Vector getResponse(String subscriberName,
                          byte[] measurementMessage)
                   throws IllegalArgumentException
------------------------------------------------------------------------ This method should be invoked whenever the transport/measurement subscriber receives a measurement message that was sent out via the PerformanceMeasurementListener.performanceMessagesAvailable(). Response messages are of the format: Byte 0: 1 Byte 1: SeqNum reply to Byte 2-9: Echo of the ping sent time Byte 10-17: The reception time.

Parameters:
subscriberName - The unique name of the measurement subscriber
measurementMessage - The message that was received.
Returns:
A vector of response messages(ByteArrayOutputStream) that the subscriber should deliver back to the PerformanceMeasurement object that sent the messages.
Throws:
IllegalArgumentException - the measurementMessage format is wrong.

interpretResults

public void interpretResults(String subscriberName,
                             byte[] results)
                      throws IllegalArgumentException
------------------------------------------------------------------------ This method should be invoked when the measurement sender receives a response message from other side.

Parameters:
subscriberName - The unique name from which reply is for. Same as the PerformanceMeasurementListener.getName().
results - The byte stream containing the reply to the measurement messages sent.
Throws:
IllegalArgumentException - results has invalid format.

addMeasurementListener

public void addMeasurementListener(PerformanceMeasurementListener l)
------------------------------------------------------------------------ Add a subscriber to the performance measurement service.


removeMeasurementListener

public void removeMeasurementListener(PerformanceMeasurementListener l)
------------------------------------------------------------------------



For comments and suggestions please send e-mail to The NaradaBrokering Project