Brief description of class still missing. More...
#include <Flowmeter.h>
Public Member Functions | |
void | addPacket (int currentByteCount) |
int | ballastFactor () const |
Flowmeter () | |
const FlowMeasurement & | measurement () const |
void | setBallastFactor (int n) |
void | setReceiveByteCount (int byteCount) |
void | setSendByteCount (int byteCount) |
void | startGlobal () |
void | startSend () |
void | stopGlobal () |
void | stopSend () |
Brief description of class still missing.
Full description of class still missing
{ _ballastFactor=16; }
void Flowmeter::addPacket | ( | int | currentByteCount | ) |
References FlowMeasurement::addPacket(), GpCoreTools::Chrono::elapsed(), FlowMeasurement::InitFailed, FlowMeasurement::packetCount(), FlowMeasurement::receiveByteCount(), FlowMeasurement::Receiving, FlowMeasurement::setReceiveRate(), FlowMeasurement::setStatus(), GpCoreTools::Chrono::start(), FlowMeasurement::status(), and FlowMeasurement::Successful.
Referenced by LinkBuffer::bytesAvailable().
{ if(_measurement.packetCount()==0) { _byteReceiveTime.start(); _initByteCount=currentByteCount; if(currentByteCount>0.1*_measurement.receiveByteCount()) { _measurement.setStatus(FlowMeasurement::InitFailed); } else { _measurement.setStatus(FlowMeasurement::Receiving); } } else if(currentByteCount==_measurement.receiveByteCount()) { double t=_byteReceiveTime.elapsed(); _measurement.setReceiveRate((currentByteCount-_initByteCount)/(1024*t)); if(_measurement.status()==FlowMeasurement::Receiving) { _measurement.setStatus(FlowMeasurement::Successful); } } _measurement.addPacket(); }
int Flowmeter::ballastFactor | ( | ) | const [inline] |
Referenced by LinkBuffer::bytesAvailable().
{return _ballastFactor;}
const FlowMeasurement& Flowmeter::measurement | ( | ) | const [inline] |
Referenced by LinkBuffer::bytesAvailable().
{return _measurement;}
void Flowmeter::setBallastFactor | ( | int | n | ) | [inline] |
Referenced by LinkBuffer::bytesAvailable().
{_ballastFactor=n;}
void Flowmeter::setReceiveByteCount | ( | int | byteCount | ) | [inline] |
References FlowMeasurement::setReceiveByteCount().
Referenced by LinkBuffer::bytesAvailable().
{_measurement.setReceiveByteCount(byteCount);}
void Flowmeter::setSendByteCount | ( | int | byteCount | ) | [inline] |
References FlowMeasurement::setSendByteCount().
{_measurement.setSendByteCount(byteCount);}
void Flowmeter::startGlobal | ( | ) |
References FlowMeasurement::Reset, FlowMeasurement::resetPacketCount(), FlowMeasurement::setStatus(), and GpCoreTools::Chrono::start().
Referenced by LinkBuffer::bytesAvailable(), and LinkBuffer::startMeasure().
{ _globalTime.start(); _measurement.resetPacketCount(); _measurement.setStatus(FlowMeasurement::Reset); }
void Flowmeter::startSend | ( | ) |
References GpCoreTools::Chrono::start().
{ _byteSendTime.start(); }
void Flowmeter::stopGlobal | ( | ) |
References GpCoreTools::Chrono::elapsed(), and FlowMeasurement::setGlobalTime().
Referenced by LinkBuffer::bytesAvailable().
{ _measurement.setGlobalTime(_globalTime.elapsed()); }
void Flowmeter::stopSend | ( | ) |
References GpCoreTools::Chrono::elapsed(), FlowMeasurement::sendByteCount(), and FlowMeasurement::setSendRate().
{ double t=_byteSendTime.elapsed(); _measurement.setSendRate(_measurement.sendByteCount()/(1024*t)); }