EPONImplementationforOMNet++
0.8Beta
|
This class hold pointers to cOutVectors. More...
#include <CopyableQueueCVectors.h>
Public Member Functions | |
CopyableQueueCVectors () | |
virtual | ~CopyableQueueCVectors () |
void | recordVectors () |
void | setVectorNames (std::string name) |
void | deleteVectors () |
double | getGranularity () |
void | setGranularity (double gran) |
unsigned long | getIncomingBPS () |
Return INSTANT incoming rate from the previous update till now (bits). | |
unsigned long | getLastSecIncomingBPS () |
Return the previous second incoming Rate (bits) | |
Public Attributes | |
unsigned long | numBytesSent |
unsigned long | numBytesDropped |
unsigned long | numFramesSent |
uint64_t | numIncomingBitsOld |
Runtime Statistics. | |
uint64_t | numIncomingBits |
uint64_t | incomingBPS |
cOutVector * | numBytesSentVector |
cOutVector * | numBytesDroppedVector |
cOutVector * | numFramesSentVector |
Private Attributes | |
unsigned long | numBytesSentPrev |
simtime_t | lastUpdateTime |
double | granularity |
Time window in which to count /second variables. | |
unsigned long | numBytesSent_old |
Try to minimize logging... | |
unsigned long | numBytesDropped_old |
unsigned long | numFramesSent_old |
This class hold pointers to cOutVectors.
This way it can be copied by the default copy constructor.
The drawback is that WE CANNOT DELETE/FREE memory in the destructor. The only "safe" way to free, is in the module/class that uses a CopyableQueueCVectors instance. Thus the container object MUST call deleteVectors() at some point.
{ numBytesSentVector = new cOutVector(); numBytesDroppedVector = new cOutVector(); numFramesSentVector = new cOutVector(); numBytesSent = 0; numBytesDropped = 0; numFramesSent = 0; numBytesSent_old = 0; numBytesDropped_old = 0; numFramesSent_old = 0; lastUpdateTime = simTime(); granularity=1; numIncomingBits = numIncomingBitsOld = incomingBPS = 0; }
CopyableQueueCVectors::~CopyableQueueCVectors | ( | ) | [virtual] |
{ // NOTE: DO NOT DELETE cOutVectors ... // This is called when you add a queue to // a vector. }
void CopyableQueueCVectors::deleteVectors | ( | ) |
{ delete numBytesSentVector; delete numBytesDroppedVector; delete numFramesSentVector; }
double CopyableQueueCVectors::getGranularity | ( | ) |
{ return granularity; }
unsigned long CopyableQueueCVectors::getIncomingBPS | ( | ) |
Return INSTANT incoming rate from the previous update till now (bits).
{ // No traffic for the last second if (simTime() - lastUpdateTime > granularity) return 0; if (simTime().raw() > lastUpdateTime.raw()) return (numIncomingBits - numIncomingBitsOld)/(simTime() - lastUpdateTime); else return incomingBPS; }
unsigned long CopyableQueueCVectors::getLastSecIncomingBPS | ( | ) |
Return the previous second incoming Rate (bits)
{ return incomingBPS; }
void CopyableQueueCVectors::recordVectors | ( | ) |
WARNING 0/0 = UNEXPECTED FUCKIN RESULT (OVERFLOWS STH)
{ if (numBytesSent!=numBytesSent_old) numBytesSentVector->record(numBytesSent); if (numBytesDropped!=numBytesDropped_old) numBytesDroppedVector->record(numBytesDropped); if (numFramesSent!=numFramesSent_old) numFramesSentVector->record(numFramesSent); numBytesSent_old=numBytesSent; numBytesDropped_old=numBytesDropped; numFramesSent_old=numFramesSent; /* In order to dynamically change the in queue size... (we can log incoming Frame Rate) Although I m not a Q expert... http://www.opalsoft.net/qos/DS.htm explains much more sophisticated queue types. */ /* Hold stats per second NOTE: 5x 10x and so on granularity can be implemented if needed. (OLT and general the DBA algorithm can internally do this) */ if (numIncomingBits - numIncomingBitsOld != 0 && simTime().raw() != lastUpdateTime.raw()) incomingBPS = (numIncomingBits - numIncomingBitsOld)/(simTime() - lastUpdateTime); // INCOMMING if (simTime() - lastUpdateTime >= granularity){ lastUpdateTime = simTime(); numIncomingBitsOld = numIncomingBits; incomingBPS = 0; } }
void CopyableQueueCVectors::setGranularity | ( | double | gran | ) |
{ granularity = gran; }
void CopyableQueueCVectors::setVectorNames | ( | std::string | name | ) |
{ std::string tmp_name; tmp_name = name + " bytesSent"; numBytesSentVector->setName(tmp_name.c_str()); numBytesSentVector->setInterpolationMode(cOutVector::LINEAR); tmp_name = name + " bytesDropped"; numBytesDroppedVector->setName(tmp_name.c_str()); tmp_name = name + " framesSent"; numFramesSentVector->setName(tmp_name.c_str()); }
double CopyableQueueCVectors::granularity [private] |
Time window in which to count /second variables.
uint64_t CopyableQueueCVectors::incomingBPS |
simtime_t CopyableQueueCVectors::lastUpdateTime [private] |
unsigned long CopyableQueueCVectors::numBytesDropped |
unsigned long CopyableQueueCVectors::numBytesDropped_old [private] |
cOutVector* CopyableQueueCVectors::numBytesDroppedVector |
unsigned long CopyableQueueCVectors::numBytesSent |
unsigned long CopyableQueueCVectors::numBytesSent_old [private] |
Try to minimize logging...
unsigned long CopyableQueueCVectors::numBytesSentPrev [private] |
cOutVector* CopyableQueueCVectors::numBytesSentVector |
unsigned long CopyableQueueCVectors::numFramesSent |
unsigned long CopyableQueueCVectors::numFramesSent_old [private] |
cOutVector* CopyableQueueCVectors::numFramesSentVector |
Runtime Statistics.
These are not going to be logged to cOutVectors since analysis can be done finally. But we need them for DBAs.
NOTE: The real way** should be to log drop rate (DoR) and data rate (DaR), then: DoR + DaR = REQUESTED_DATARATE.
What we do is logging IncommingRate (IR) or else REQUESTED_DATARATE thus: IR - DaR = DoR
** By "real way" we mean what we HAVE SEEN on real network hardware.