Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

RateEstimator Class Reference

#include <rate-estimator.h>

Collaboration diagram for RateEstimator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RateEstimator ()
 RateEstimator (double estimate)
void estimateRate (Packet *p)
void reset ()

Public Attributes

double k_
double estRate_
double bytesArr_

Protected Attributes

int temp_size_
double prevTime_
double reset_time_

Constructor & Destructor Documentation

RateEstimator::RateEstimator  ) 
 

Definition at line 4 of file rate-estimator.cc.

References Scheduler::clock(), Scheduler::instance(), prevTime_, and reset_time_.

00004                             : k_(0.1), estRate_(0.0), bytesArr_(0.0), temp_size_(0) {
00005   prevTime_ = Scheduler::instance().clock();
00006   reset_time_ = Scheduler::instance().clock();
00007 }

Here is the call graph for this function:

RateEstimator::RateEstimator double  estimate  ) 
 

Definition at line 9 of file rate-estimator.cc.

References Scheduler::clock(), estRate_, Scheduler::instance(), prevTime_, and reset_time_.

00009                                            : k_(0.1), bytesArr_(0.0), temp_size_(0) {
00010   prevTime_ = Scheduler::instance().clock();
00011   reset_time_ = Scheduler::instance().clock();
00012   estRate_ = estimate;
00013 }

Here is the call graph for this function:


Member Function Documentation

void RateEstimator::estimateRate Packet p  ) 
 

Definition at line 16 of file rate-estimator.cc.

References bytesArr_, Scheduler::clock(), estRate_, HDR_CMN, Scheduler::instance(), k_, prevTime_, hdr_cmn::size(), and temp_size_.

Referenced by PushbackQueue::enque(), LoggingDataStructNode::log(), LoggingDataStruct::log(), and RateLimitStrategy::process().

00016                                         {
00017 
00018   hdr_cmn* hdr  = HDR_CMN(pkt);
00019   bytesArr_+= hdr->size();
00020   int pktSize   = hdr->size() << 3; /* length of the packet in bits */
00021   
00022   double now = Scheduler::instance().clock();
00023   double timeGap = ( now - prevTime_);
00024 
00025   if (timeGap == 0) {
00026     temp_size_ += pktSize;
00027     return;
00028   }
00029   else {
00030     pktSize+= temp_size_;
00031     temp_size_ = 0;
00032   }
00033         
00034   prevTime_ = now;
00035   estRate_ = (1 - exp(-timeGap/k_))*((double)pktSize)/timeGap + exp(-timeGap/k_)*estRate_;
00036 }

Here is the call graph for this function:

void RateEstimator::reset  ) 
 

Definition at line 40 of file rate-estimator.cc.

References bytesArr_, Scheduler::clock(), Scheduler::instance(), and reset_time_.

Referenced by RateLimitStrategy::reset().

00040                      {
00041   reset_time_ = Scheduler::instance().clock();
00042   bytesArr_ = 0;
00043 //shoule the rate estimate be reset?
00044   //  estRate_=0.0;
00045   //  prevTime_= Scheduler::instance().clock();
00046   // temp_size_=0;
00047 
00048 }

Here is the call graph for this function:


Member Data Documentation

double RateEstimator::bytesArr_
 

Definition at line 11 of file rate-estimator.h.

Referenced by estimateRate(), LoggingDataStructNode::log(), LoggingDataStruct::log(), and reset().

double RateEstimator::estRate_
 

Definition at line 10 of file rate-estimator.h.

Referenced by estimateRate(), RateLimitStrategy::getArrivalRate(), RateLimitStrategy::getDropRate(), PushbackQueue::getDropRate(), PushbackQueue::getRate(), LoggingDataStructNode::log(), LoggingDataStruct::log(), RateLimitSession::merge(), RateLimitStrategy::process(), PushbackAgent::pushbackCheck(), RateEstimator(), RateLimitStrategy::restrictPacketType(), and PushbackQueue::timeout().

double RateEstimator::k_
 

Definition at line 9 of file rate-estimator.h.

Referenced by estimateRate().

double RateEstimator::prevTime_ [protected]
 

Definition at line 20 of file rate-estimator.h.

Referenced by estimateRate(), and RateEstimator().

double RateEstimator::reset_time_ [protected]
 

Definition at line 21 of file rate-estimator.h.

Referenced by RateEstimator(), and reset().

int RateEstimator::temp_size_ [protected]
 

Definition at line 19 of file rate-estimator.h.

Referenced by estimateRate().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:11:51 2004 for NS2.26SourcesOriginal by doxygen 1.3.3