#include <rate-estimator.h>
Collaboration diagram for RateEstimator:

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_ |
|
|
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:

|
|
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:

|
|
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:

|
|
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:

|
|
Definition at line 11 of file rate-estimator.h. Referenced by estimateRate(), LoggingDataStructNode::log(), LoggingDataStruct::log(), and reset(). |
|
|
|
Definition at line 9 of file rate-estimator.h. Referenced by estimateRate(). |
|
|
Definition at line 20 of file rate-estimator.h. Referenced by estimateRate(), and RateEstimator(). |
|
|
Definition at line 21 of file rate-estimator.h. Referenced by RateEstimator(), and reset(). |
|
|
Definition at line 19 of file rate-estimator.h. Referenced by estimateRate(). |
1.3.3