#include <rate-limit-strategy.h>
Collaboration diagram for RateLimitStrategy:

Public Member Functions | |
| RateLimitStrategy (double rate, int ptype, double share, double estimate) | |
| ~RateLimitStrategy () | |
| double | process (Packet *p, int mine, int lowDemand) |
| void | restrictPacketType (int type, double share, double actual) |
| double | getDropRate () |
| double | getArrivalRate () |
| void | reset () |
Public Attributes | |
| double | target_rate_ |
| double | reset_time_ |
| RateEstimator * | rateEstimator_ |
| RateLimiter * | rateLimiter_ |
| int | ptype_ |
| double | ptype_share_ |
| RateEstimator * | ptypeRateEstimator_ |
| RateLimiter * | ptypeRateLimiter_ |
| PacketTypeLog * | ptypeLog_ |
|
||||||||||||||||||||
|
Definition at line 39 of file rate-limit-strategy.cc. References Scheduler::clock(), Scheduler::instance(), ptype_, ptype_share_, ptypeLog_, ptypeRateEstimator_, ptypeRateLimiter_, rateEstimator_, rateLimiter_, reset_time_, and target_rate_.
00039 {
00040
00041 target_rate_ = rate;
00042 reset_time_ = Scheduler::instance().clock();
00043
00044 ptype_ = ptype;
00045 ptype_share_ = share;
00046
00047 // if (debug_)
00048 // printf("TB: Starting a token bucket at %g with rate %g bps\n", Scheduler::instance().clock(), rate);
00049 rateEstimator_ = new RateEstimator(estimate);
00050 rateLimiter_ = new TokenBucketRateLimiter();
00051
00052 ptypeRateEstimator_ = new RateEstimator();
00053 ptypeRateLimiter_ = new TokenBucketRateLimiter();
00054
00055 ptypeLog_ = new PacketTypeLog(this);
00056 }
|
Here is the call graph for this function:

|
|
Definition at line 114 of file rate-limit-strategy.cc. References ptypeLog_, ptypeRateEstimator_, ptypeRateLimiter_, rateEstimator_, and rateLimiter_.
00114 {
00115 delete(rateLimiter_);
00116 delete(ptypeRateLimiter_);
00117 delete(rateEstimator_);
00118 delete(ptypeRateEstimator_);
00119 delete(ptypeLog_);
00120 }
|
|
|
Definition at line 102 of file rate-limit-strategy.cc. References RateEstimator::estRate_, and rateEstimator_. Referenced by RateLimitSession::getArrivalRateForStatus().
00102 {
00103 return rateEstimator_->estRate_;
00104 }
|
|
|
Definition at line 94 of file rate-limit-strategy.cc. References RateEstimator::estRate_, rateEstimator_, and target_rate_. Referenced by RateLimitSession::getDropRate().
00094 {
00095 double inRate = rateEstimator_->estRate_;
00096 double dropRate = (inRate - target_rate_)/inRate;
00097 if (dropRate < 0) dropRate=0;
00098 return dropRate;
00099 }
|
|
||||||||||||||||
|
Definition at line 59 of file rate-limit-strategy.cc. References RateEstimator::estimateRate(), RateEstimator::estRate_, HDR_CMN, PacketTypeLog::log(), hdr_cmn::ptype(), ptype_, ptype_share_, ptypeLog_, ptypeRateEstimator_, ptypeRateLimiter_, rateEstimator_, RateLimiter::rateLimit(), rateLimiter_, and target_rate_. Referenced by RateLimitSession::log().
00059 {
00060
00061 rateEstimator_->estimateRate(p);
00062 ptypeLog_->log(p);
00063
00064 hdr_cmn* hdr = HDR_CMN(p);
00065
00066 int dropped = 0;
00067 if (hdr->ptype() == ptype_) {
00068 ptypeRateEstimator_->estimateRate(p);
00069 dropped = ptypeRateLimiter_->rateLimit(p, ptypeRateEstimator_->estRate_,
00070 target_rate_*ptype_share_, mine, lowDemand);
00071 }
00072
00073 if (dropped) return 1;
00074
00075 dropped = rateLimiter_->rateLimit(p, rateEstimator_->estRate_, target_rate_, mine, lowDemand);
00076 return dropped;
00077 }
|
Here is the call graph for this function:

|
|
Definition at line 107 of file rate-limit-strategy.cc. References ptypeRateEstimator_, ptypeRateLimiter_, rateEstimator_, rateLimiter_, RateEstimator::reset(), and RateLimiter::reset(). Referenced by RateLimitSession::pushbackOn().
00107 {
00108 rateLimiter_->reset();
00109 ptypeRateLimiter_->reset();
00110 rateEstimator_->reset();
00111 ptypeRateEstimator_->reset();
00112 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 80 of file rate-limit-strategy.cc. References RateEstimator::estRate_, Scheduler::instance(), ptype_, ptype_share_, ptypeRateEstimator_, and rateEstimator_. Referenced by PacketTypeLog::expire().
00080 {
00081
00082 if (type == ptype_) {
00083 return;
00084 }
00085
00086 printf("RLSt: Restricting type %d to %g hogging=%g at %g \n", type, share, actual,
00087 Scheduler::instance().clock());
00088 ptype_ = type;
00089 ptype_share_ = share;
00090 ptypeRateEstimator_->estRate_ = rateEstimator_->estRate_*actual;
00091 }
|
Here is the call graph for this function:

|
|
Definition at line 63 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), and restrictPacketType(). |
|
|
Definition at line 64 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), and restrictPacketType(). |
|
|
Definition at line 68 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), and ~RateLimitStrategy(). |
|
|
Definition at line 65 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), reset(), restrictPacketType(), and ~RateLimitStrategy(). |
|
|
Definition at line 66 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), reset(), and ~RateLimitStrategy(). |
|
|
Definition at line 60 of file rate-limit-strategy.h. Referenced by getArrivalRate(), getDropRate(), RateLimitSession::merge(), process(), RateLimitStrategy(), reset(), restrictPacketType(), and ~RateLimitStrategy(). |
|
|
Definition at line 61 of file rate-limit-strategy.h. Referenced by process(), RateLimitStrategy(), reset(), and ~RateLimitStrategy(). |
|
|
Definition at line 58 of file rate-limit-strategy.h. Referenced by RateLimitStrategy(). |
|
|
Definition at line 57 of file rate-limit-strategy.h. Referenced by getDropRate(), PushbackAgent::initialUpdate(), RateLimitSession::merge(), process(), PushbackAgent::pushbackCheck(), PushbackAgent::pushbackRefresh(), RateLimitStrategy(), PushbackAgent::refreshUpstreamLimits(), and RateLimitSession::setLimit(). |
1.3.3