EPONImplementationforOMNet++  0.8Beta
CopyableQueueCVectors Class Reference

This class hold pointers to cOutVectors. More...

#include <CopyableQueueCVectors.h>

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

                                              {
      // NOTE: DO NOT DELETE cOutVectors ...
      // This is called when you add a queue to
      // a vector.
}

Member Function Documentation

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;

}

Return the previous second incoming Rate (bits)

                                                          {
      return incomingBPS;
}

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;
      }
}
                                                     {
      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());
}

Member Data Documentation

Time window in which to count /second variables.

unsigned long CopyableQueueCVectors::numBytesSent_old [private]

Try to minimize logging...

unsigned long CopyableQueueCVectors::numBytesSentPrev [private]

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.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines