Commit 8bacac71 authored by Robert Ricci's avatar Robert Ricci

Support the TSThrougput sensor, and make it the throughput sensor

used by the LeastSquaresThroughput sensor.

By manual comparison to tcpdump output, the inter-packet arrival time
seems to be computed correctly. However, it seems like it is still
returning bandwidth numbers that are too high. This is the next thing
to work on.
parent 3e749554
......@@ -2,14 +2,14 @@
#include "lib.h"
#include "LeastSquaresThroughput.h"
#include "ThroughputSensor.h"
#include "TSThroughputSensor.h"
#include "DelaySensor.h"
#include "CommandOutput.h"
using namespace std;
LeastSquaresThroughput::LeastSquaresThroughput(
ThroughputSensor const * newThroughput,
TSThroughputSensor const * newThroughput,
DelaySensor const * newDelay)
: throughput(newThroughput)
......@@ -74,7 +74,8 @@ void LeastSquaresThroughput::localAck(PacketInfo * packet)
// sample numbers which monotonically increase.
double slope = num/denom;
logWrite(SENSOR, "LeastSquares: SLOPE: %f", slope);
logWrite(SENSOR, "LeastSquares: SLOPE: %f TPA: %i LR:%i", slope,
static_cast<int>(throughputAverage),lastReport);
if (slope > 0)
{
......
......@@ -8,20 +8,20 @@
#include "Sensor.h"
class ThroughputSensor;
class TSThroughputSensor;
class DelaySensor;
class LeastSquaresThroughput : public Sensor
{
public:
LeastSquaresThroughput(ThroughputSensor const * newThroughput,
LeastSquaresThroughput(TSThroughputSensor const * newThroughput,
DelaySensor const * newDelay);
virtual ~LeastSquaresThroughput();
protected:
virtual void localSend(PacketInfo * packet);
virtual void localAck(PacketInfo * packet);
private:
ThroughputSensor const * throughput;
TSThroughputSensor const * throughput;
DelaySensor const * delay;
// The number of samples kept at any given time.
......
......@@ -12,6 +12,7 @@
#include "MinDelaySensor.h"
#include "MaxDelaySensor.h"
#include "ThroughputSensor.h"
#include "TSThroughputSensor.h"
#include "EwmaThroughputSensor.h"
#include "LeastSquaresThroughput.h"
......@@ -74,6 +75,9 @@ void SensorList::addSensor(SensorCommand const & newSensor)
case THROUGHPUT_SENSOR:
pushThroughputSensor();
break;
case TSTHROUGHPUT_SENSOR:
pushTSThroughputSensor();
break;
case EWMA_THROUGHPUT_SENSOR:
pushEwmaThroughputSensor();
break;
......@@ -103,6 +107,7 @@ void SensorList::reset(void)
depPacketSensor = NULL;
depDelaySensor = NULL;
depThroughputSensor = NULL;
depTSThroughputSensor = NULL;
depMinDelaySensor = NULL;
}
......@@ -247,6 +252,26 @@ void SensorList::pushThroughputSensor(void)
}
}
void SensorList::pushTSThroughputSensor(void)
{
// Dependency list
pushStateSensor();
pushPacketSensor();
// Example dependency check
if (depTSThroughputSensor == NULL)
{
logWrite(SENSOR, "Adding TSThroughputSensor");
TSThroughputSensor * newSensor = new TSThroughputSensor(depPacketSensor,
depStateSensor);
std::auto_ptr<Sensor> current(newSensor);
pushSensor(current);
// Example dependency set
depTSThroughputSensor = newSensor;
}
}
void SensorList::pushEwmaThroughputSensor(void)
{
// Dependency list
......@@ -262,11 +287,11 @@ void SensorList::pushEwmaThroughputSensor(void)
void SensorList::pushLeastSquaresThroughput(void)
{
// Dependency list
pushThroughputSensor();
pushTSThroughputSensor();
pushDelaySensor();
logWrite(SENSOR, "Adding LeastSquaresThroughput");
std::auto_ptr<Sensor> current(new LeastSquaresThroughput(depThroughputSensor,
std::auto_ptr<Sensor> current(new LeastSquaresThroughput(depTSThroughputSensor,
depDelaySensor));
pushSensor(current);
}
......@@ -28,6 +28,7 @@ class DelaySensor;
class MinDelaySensor;
class MaxDelaySensor;
class ThroughputSensor;
class TSThroughputSensor;
class EwmaThroughputSensor;
class LeastSquaresThroughput;
......@@ -54,6 +55,7 @@ private:
void pushMinDelaySensor(void);
void pushMaxDelaySensor(void);
void pushThroughputSensor(void);
void pushTSThroughputSensor(void);
void pushEwmaThroughputSensor(void);
void pushLeastSquaresThroughput(void);
private:
......@@ -65,6 +67,7 @@ private:
DelaySensor const * depDelaySensor;
MinDelaySensor const * depMinDelaySensor;
ThroughputSensor const * depThroughputSensor;
TSThroughputSensor const * depTSThroughputSensor;
};
#endif
......@@ -106,7 +106,8 @@ enum SensorType
MAX_DELAY_SENSOR = 5,
THROUGHPUT_SENSOR = 6,
EWMA_THROUGHPUT_SENSOR = 7,
LEAST_SQUARES_THROUGHPUT = 8
LEAST_SQUARES_THROUGHPUT = 8,
TSTHROUGHPUT_SENSOR = 9
};
// This is used for the type field in the ConnectionModelCommand.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment