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

RedPDQueue Class Reference

#include <red-pd.h>

Inheritance diagram for RedPDQueue:

Inheritance graph
[legend]
Collaboration diagram for RedPDQueue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RedPDQueue (const char *="Drop", const char *="Drop")
void setFlowMon (FlowMon *flowMon)
virtual void recv (Packet *, Handler *)
virtual void recv (Packet *p, const char *s)
virtual void updateStats (int queuesize)
void resume ()
int blocked () const
void unblock ()
void block ()
int limit ()
int length ()
int byteLength ()
virtual double utilization (void)
virtual void destroy ()
void enqueue (QueueElem< T > *e)
QueueElem< T > * dequeue ()
void detach (QueueElem< T > *e)
QueueElem< T > * getHead ()
int is_empty () const
int size () const
NsObjecttarget ()
virtual void drop (Packet *p)
virtual void recvOnly (Packet *)
virtual void delay_bind_init_all ()
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
int isdebug () const
virtual void debug (const char *fmt,...)

Public Attributes

int auto_
int global_target_
double targetBW_
int noMonitored_
double unresponsive_penalty_
double P_testFRp_
int noidle_

Protected Member Functions

int command (int argc, const char *const *argv)
void reset ()
void enque (Packet *pkt)
double getP_monFlow (double current, double target)
virtual PacketpickPacketForECN (Packet *pkt)
virtual PacketpickPacketToDrop ()
Packetdeque ()
void initialize_params ()
void run_estimator (int nqueued, int m)
double estimator (int nqueued, int m, double ave, double q_w)
void updateMaxP (double new_ave, double now)
void updateMaxPFeng (double new_ave)
int drop_early (Packet *pkt)
double modify_p (double p, int count, int count_bytes, int bytes, int mean_pktsize, int wait, int size)
double calculate_p_new (double v_ave, double th_max, int gentle, double v_a, double v_b, double v_c, double v_d, double max_p)
double calculate_p (double v_ave, double th_max, int gentle, double v_a, double v_b, double v_c, double v_d, double max_p_inv)
virtual void reportDrop (Packet *pkt)
void print_summarystats ()
int bcount_ ()
void trace (TracedVar *)
void print_edp ()
void print_edv ()
void utilUpdate (double int_begin, double int_end, int link_state)
virtual void drop (Packet *p, const char *s)
void send (Packet *p, Handler *h)
void handle (Event *)

Protected Attributes

int off_ip_
FlowMonflowMonitor_
char medTraceType [20]
NsObjectMEDTrace
int summarystats_
LinkDelaylink_
int fifo_
PacketQueueq_
int qib_
NsObjectde_drop_
NsObjectEDTrace
char traceType [20]
Tcl_Channel tchan_
TracedInt curq_
int drop_tail_
int drop_front_
int drop_rand_
int ns1_compat_
edp edp_
int doubleq_
int dqthresh_
int idle_
double idletime_
edv edv_
int first_reset_
int qlim_
int blocked_
int unblock_on_resume_
QueueHandler qh_
PacketQueuepq_
double true_ave_
double total_time_
double last_change_
double old_util_
double util_weight_
QueueElem< T > * head_
QueueElem< T > * tail_
int size_
NsObjecttarget_
NsObjectdrop_
int debug_

Constructor & Destructor Documentation

RedPDQueue::RedPDQueue const char *  = "Drop",
const char *  = "Drop"
 

Definition at line 80 of file red-pd.cc.

References auto_, global_target_, medTraceType, noidle_, noMonitored_, off_ip_, hdr_ip::offset(), P_testFRp_, targetBW_, and unresponsive_penalty_.

00080                                                                : REDQueue(edtype),
00081         auto_(0), global_target_(0), targetBW_(0), noMonitored_(0), 
00082         unresponsive_penalty_(1), P_testFRp_(-1), noidle_(0),
00083         flowMonitor_(NULL), MEDTrace(NULL) {
00084 
00085         //printf("In RedPD constructor with %s %s\n", medtype, edtype);
00086         if (strlen(medtype) >=20) {
00087                 printf("RedPD : Too Long a trace type. Change the field length in red-pd.h and recompile\n");
00088                 exit(0);
00089         }
00090         strcpy(medTraceType, medtype);
00091         
00092         off_ip_ = hdr_ip::offset();
00093         
00094         bind_bool("auto_", &auto_);
00095         bind_bool("global_target_", &global_target_);
00096         bind_bool("noidle_", &noidle_);
00097         bind_bw("targetBW_", &targetBW_);
00098         bind("noMonitored_", &noMonitored_);
00099         bind("unresponsive_penalty_", &unresponsive_penalty_);
00100         bind("P_testFRp_", &P_testFRp_);
00101 }

Here is the call graph for this function:


Member Function Documentation

int REDQueue::bcount_  )  [inline, protected, inherited]
 

Definition at line 167 of file red.h.

References PacketQueue::byteLength(), and REDQueue::q_.

00167 { return q_->byteLength(); };           

Here is the call graph for this function:

template<class T>
void Queue< T >::block  )  [inline, inherited]
 

Definition at line 131 of file queue.h.

References Queue< T >::blocked_.

00131 { blocked_ = 1; }

template<class T>
int Queue< T >::blocked  )  const [inline, inherited]
 

Definition at line 129 of file queue.h.

References Queue< T >::blocked_.

Referenced by CBQClass::recv().

00129 { return (blocked_ == 1); }

template<class T>
int Queue< T >::byteLength  )  [inline, inherited]
 

Definition at line 135 of file queue.h.

References PacketQueue::byteLength(), and Queue< T >::pq_.

00135 { return pq_->byteLength(); }   /* number of bytes *

Here is the call graph for this function:

double REDQueue::calculate_p double  v_ave,
double  th_max,
int  gentle,
double  v_a,
double  v_b,
double  v_c,
double  v_d,
double  max_p_inv
[protected, inherited]
 

Definition at line 394 of file red.cc.

References REDQueue::calculate_p_new().

Referenced by RIOQueue::drop_in_early(), and RIOQueue::drop_out_early().

00396 {
00397         double p = calculate_p_new(v_ave, th_max, gentle, v_a,
00398                 v_b, v_c, v_d, 1.0 / max_p_inv);
00399         return p;
00400 }

Here is the call graph for this function:

double REDQueue::calculate_p_new double  v_ave,
double  th_max,
int  gentle,
double  v_a,
double  v_b,
double  v_c,
double  v_d,
double  max_p
[protected, inherited]
 

Definition at line 370 of file red.cc.

Referenced by REDQueue::calculate_p(), and REDQueue::drop_early().

00372 {
00373         double p;
00374         if (gentle && v_ave >= th_max) {
00375                 // p ranges from max_p to 1 as the average queue
00376                 // size ranges from th_max to twice th_max 
00377                 p = v_c * v_ave + v_d;
00378         } else {
00379                 // p ranges from 0 to max_p as the average queue
00380                 // size ranges from th_min to th_max 
00381                 p = v_a * v_ave + v_b;
00382                 p *= max_p;
00383         }
00384         if (p > 1.0)
00385                 p = 1.0;
00386         return p;
00387 }

int RedPDQueue::command int  argc,
const char *const *  argv
[protected, virtual]
 

Reimplemented from REDQueue.

Definition at line 239 of file red-pd.cc.

References auto_, RedPDFlow::auto_, Scheduler::clock(), REDQueue::command(), RedPDFlow::currentBW_, REDQueue::de_drop_, NsObject::debug_, QueueMonitor::estimate_rate_, QueueMonitor::estRate_, Flow::flowid(), flowMonitor_, Scheduler::instance(), RedPDFlow::lastDropTime_, MEDTrace, medTraceType, RedPDFlow::monitored_, RedPDFlow::monitorStartTime_, noMonitored_, RedPDFlow::unresponsive_, and RedPDFlow::unresponsiveStartTime_.

00239                                                         {
00240 
00241         Tcl& tcl = Tcl::instance();
00242         if (argc==2) {
00243                 if (strcmp(argv[1], "mon-edrop-trace") == 0) {
00244                         if (MEDTrace != NULL) {
00245                                 tcl.resultf("%s", MEDTrace->name());
00246                                 //printf("Exists according to RedPD\n");
00247                         }
00248                         else {
00249                                 //printf("Doesn't exist according to RedPD\n");
00250                                 tcl.resultf("0");
00251                         }
00252                         return (TCL_OK);
00253                 }
00254                 if (strcmp(argv[1], "mon-trace-type") == 0) {
00255                         tcl.resultf("%s",medTraceType);
00256                         return (TCL_OK);
00257                 }
00258         }
00259         else if (argc == 3) {
00260                 //$queue attach-flowmon $flowMon
00261                 if (strcmp(argv[1], "attach-flowmon") == 0) {
00262                         
00263                         flowMonitor_ = (FlowMon *) TclObject::lookup(argv[2]);
00264                         if (flowMonitor_ == NULL) {
00265                                 if (debug_) printf("Error Creating Flowmonitor\n");
00266                                 return (TCL_ERROR);
00267                         }
00268                         if (debug_) 
00269                                 printf("RedPD: Flow Monitor Set to %s\n", flowMonitor_->name());
00270         
00271                         de_drop_ = (NsObject *) flowMonitor_;
00272                         return (TCL_OK);
00273                 }
00274                 //$queue showme $flow
00275                 //prints the monitoring status of the flow
00276                 else if (strcmp(argv[1], "showme") == 0) {
00277 
00278                         RedPDFlow * flow = (RedPDFlow *) TclObject::lookup(argv[2]);
00279                         printf("showing now : %s = %d\n", flow->name(), flow->monitored_);
00280                         return (TCL_OK);
00281                 }
00282                 //$queue mon-edrop-trace $trace
00283                 //attaches the trace object to the queue
00284                 else if (strcmp(argv[1], "mon-edrop-trace") == 0) {
00285                         
00286                         MEDTrace = (NsObject *) TclObject::lookup(argv[2]);
00287                         if (MEDTrace == NULL) {
00288                                 if (debug_) printf("Error Attaching Trace\n");
00289                                 return (TCL_ERROR);
00290                         }
00291                         if (debug_) 
00292                                 printf("RedPD: MEDTrace Set to %s\n", flowMonitor_->name());
00293                         return (TCL_OK);
00294                 }
00295                 //$queue unmonitor-flow $flow
00296                 else if (strcmp(argv[1], "unmonitor-flow") == 0) {
00297                         RedPDFlow * flow = (RedPDFlow *) TclObject::lookup(argv[2]);
00298                         
00299                         if (flow->monitored_ != 1) {
00300                                 tcl.resultf("Cannot unmonitor an unmonitored flow: %d\n", flow->flowid());
00301                                 return(TCL_ERROR);
00302                         }
00303 
00304                         flow->monitored_ = 0;
00305                         flow->unresponsive_ = 0;
00306                         flow->monitorStartTime_ = 0;
00307                         flow->lastDropTime_ = 0;
00308                         flow->unresponsiveStartTime_ = 0;
00309 
00310                         noMonitored_--;
00311 
00312                         if ( noMonitored_ < 0 ) {
00313                                 tcl.resultf("noMonitored gone below ZERO\n");
00314                                 return TCL_ERROR;
00315                         }
00316                         return TCL_OK;
00317                 }
00318                 //$queue unresponsive-flow $flow
00319                 //declare a flow unresponsive
00320                 else if (strcmp(argv[1], "unresponsive-flow") == 0) {
00321                         RedPDFlow * flow = (RedPDFlow *) TclObject::lookup(argv[2]);
00322                         
00323                         if (flow->monitored_ != 1) {
00324                                 tcl.resultf("Cannot make an unmonitored flow unresponsive: %d\n", 
00325                                             flow->flowid());
00326                                 return(TCL_ERROR);
00327                         }
00328 
00329                         if (flow->unresponsive_ != 1) {
00330                                 flow->unresponsive_ = 1;
00331                                 flow->unresponsiveStartTime_ = Scheduler::instance().clock();
00332                         }
00333 
00334                         if (flow->auto_) {
00335                                 flow->estimate_rate_=1;
00336                         }
00337                         
00338                         return TCL_OK;
00339                 }
00340                 //$queue responsive-flow $flow
00341                 else if (strcmp(argv[1], "responsive-flow") == 0) {
00342                         RedPDFlow * flow = (RedPDFlow *) TclObject::lookup(argv[2]);
00343                         
00344                         if (flow->unresponsive_ != 1) {
00345                                 tcl.resultf("Cannot make a responsive flow responsive: %d\n", 
00346                                             flow->flowid());
00347                                 return(TCL_ERROR);
00348                         }
00349                         flow->unresponsive_ = 0;
00350                         flow->unresponsiveStartTime_ = 0;
00351                         
00352                         return TCL_OK;
00353                 }
00354         }
00355         else if (argc == 4) {
00356                 //$queue monitor-flow $flow $prob
00357                 //monitor a flow with probability $prob
00358                 if (strcmp(argv[1], "monitor-flow") == 0) {
00359                         //this is a round about way of doing things, but ... historical
00360                         //monitoring a flow with probability p, is same as 
00361                         //monitoring it with targetBW 1-p and currentBW 1. 
00362                         tcl.evalf("%s monitor-flow %s %g 1",name(), argv[2], 1 - atof(argv[3]));
00363                         return(TCL_OK);
00364                 }
00365         }
00366         else if (argc == 5) {
00367                 //$queue monitor-flow $flow $targetBW $currentBW 
00368                 if (strcmp(argv[1], "monitor-flow") == 0) {
00369                         RedPDFlow * flow = (RedPDFlow *) TclObject::lookup(argv[2]);
00370                         
00371                         tcl.evalf("%s set targetBW_ %s", flow->name(), argv[3]);
00372                         tcl.evalf("%s set currentBW_ %s", flow->name(), argv[4]);
00373                         
00374                         if (flow->monitored_ != 1) {
00375                                 flow->monitored_=1;
00376                                 noMonitored_ ++;
00377                                 flow->monitorStartTime_ = Scheduler::instance().clock();
00378                         }
00379                         
00380                         //if auto_ is ON initialize the rate estimation with the current bandwidth
00381                         if (auto_) {
00382                                 flow->estimate_rate_=1;
00383                                 flow->estRate_ = flow->currentBW_;
00384                         }
00385                         
00386                         return (TCL_OK);
00387                 }
00388         }
00389         
00390         return (REDQueue::command(argc, argv));
00391 }

Here is the call graph for this function:

void NsObject::debug const char *  fmt,
... 
[virtual, inherited]
 

Definition at line 102 of file object.cc.

References NsObject::debug_.

00103 {
00104         if (!debug_)
00105                 return;
00106         va_list ap;
00107         va_start(ap, fmt);
00108         vprintf(fmt, ap);
00109 }

int NsObject::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 63 of file object.cc.

References NsObject::debug_.

Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().

00064 {
00065         if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 
00066                 return TCL_OK;
00067         return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 57 of file object.cc.

Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().

00058 {
00059         delay_bind_init_one("debug_");
00060 }

Packet * REDQueue::deque  )  [protected, virtual, inherited]
 

Implements Queue< T >.

Reimplemented in RIOQueue.

Definition at line 344 of file red.cc.

References PacketQueue::byteLength(), Scheduler::clock(), PacketQueue::deque(), REDQueue::idle_, REDQueue::idletime_, Scheduler::instance(), PacketQueue::length(), REDQueue::q_, REDQueue::qib_, REDQueue::summarystats_, and Queue< T >::updateStats().

Referenced by RIOQueue::deque().

00345 {
00346         Packet *p;
00347         if (summarystats_ && &Scheduler::instance() != NULL) {
00348                 Queue::updateStats(qib_?q_->byteLength():q_->length());
00349         }
00350         p = q_->deque();
00351         if (p != 0) {
00352                 idle_ = 0;
00353         } else {
00354                 idle_ = 1;
00355                 // deque() may invoked by Queue::reset at init
00356                 // time (before the scheduler is instantiated).
00357                 // deal with this case
00358                 if (&Scheduler::instance() != NULL)
00359                         idletime_ = Scheduler::instance().clock();
00360                 else
00361                         idletime_ = 0.0;
00362         }
00363         return (p);
00364 }

Here is the call graph for this function:

template<class T>
QueueElem<T>* Queue< T >::dequeue  )  [inline, inherited]
 

Definition at line 378 of file mcache.h.

References Queue< T >::head_, QueueElem< T >::next(), QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by Queue< T >::detach(), and MediaServer::get_next_segment().

00378                                 {
00379                 QueueElem<T> *p = head_;
00380                 if (head_ != 0) 
00381                         head_ = head_->next();
00382                 if (head_ == 0)
00383                         tail_ = 0;
00384                 p->next_ = 0;
00385                 size_--;
00386                 if (size_ == 0) 
00387                         assert((head_ == 0) && (tail_ == 0));
00388                 return p;
00389         }

Here is the call graph for this function:

template<class T>
virtual void Queue< T >::destroy  )  [inline, virtual, inherited]
 

Definition at line 358 of file mcache.h.

References QueueElem< T >::data(), Queue< T >::head_, and QueueElem< T >::next().

00358                                {
00359                 QueueElem<T> *p = head_, *q;
00360                 while (p != NULL) {
00361                         q = p;
00362                         p = p->next();
00363                         delete q->data();
00364                         delete q;
00365                 }
00366                 head_ = NULL;
00367         }

Here is the call graph for this function:

template<class T>
void Queue< T >::detach QueueElem< T > *  e  )  [inline, inherited]
 

Definition at line 390 of file mcache.h.

References Queue< T >::dequeue(), Queue< T >::head_, QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by MediaServer::command().

00390                                      {
00391                 assert(head_ != 0);
00392                 if (head_ == e) {
00393                         dequeue();
00394                         return;
00395                 }
00396                 QueueElem<T> *p = head_;
00397                 while (p != NULL) {
00398                         if (p->next_ != e)
00399                                 p = p->next_;
00400                         else
00401                                 break;
00402                 }
00403                 assert(p != NULL);
00404                 p->next_ = e->next_;
00405                 if (tail_ == e)
00406                         tail_ = p;
00407                 size_--;
00408                 if (size_ == 0) 
00409                         assert((head_ == 0) && (tail_ == 0));
00410         }

Here is the call graph for this function:

void Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

Definition at line 114 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

00115 {
00116         if (drop_ != 0)
00117                 drop_->recv(p, s);
00118         else
00119                 Packet::free(p);
00120 }

Here is the call graph for this function:

void Connector::drop Packet p  )  [virtual, inherited]
 

Definition at line 106 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

Referenced by DSRAgent::acceptRouteReply(), ARPTable::arpresolve(), JoBS::dropFront(), Vq::dropPacketForECN(), DSRAgent::dropSendBuff(), JoBS::dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), PriQueue::Terminate(), DSRAgent::Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and DSRAgent::undeliverablePkt().

00107 {
00108         if (drop_ != 0)
00109                 drop_->recv(p);
00110         else
00111                 Packet::free(p);
00112 }

Here is the call graph for this function:

int REDQueue::drop_early Packet pkt  )  [protected, inherited]
 

Definition at line 441 of file red.cc.

References hdr_flags::access(), hdr_cmn::access(), PacketQueue::byteLength(), edp::bytes, REDQueue::calculate_p_new(), edp::cautious, hdr_flags::ce(), edv::count, edv::count_bytes, edv::cur_max_p, hdr_flags::ect(), REDQueue::edp_, REDQueue::edv_, edp::gentle, PacketQueue::length(), edp::mark_p, edp::mean_pktsize, REDQueue::modify_p(), REDQueue::pickPacketForECN(), pow(), edp::ptc, REDQueue::q_, edp::q_w, REDQueue::qib_, edp::setbit, hdr_cmn::size(), edp::th_max, Random::uniform(), edv::v_a, edv::v_ave, edv::v_b, edv::v_c, edv::v_d, edv::v_prob, edv::v_prob1, and edp::wait.

Referenced by REDQueue::enque().

00442 {
00443         hdr_cmn* ch = hdr_cmn::access(pkt);
00444 
00445         edv_.v_prob1 = calculate_p_new(edv_.v_ave, edp_.th_max, edp_.gentle, 
00446           edv_.v_a, edv_.v_b, edv_.v_c, edv_.v_d, edv_.cur_max_p);
00447         edv_.v_prob = modify_p(edv_.v_prob1, edv_.count, edv_.count_bytes,
00448           edp_.bytes, edp_.mean_pktsize, edp_.wait, ch->size());
00449 
00450         // drop probability is computed, pick random number and act
00451         if (edp_.cautious == 1) {
00452                  // Don't drop/mark if the instantaneous queue is much
00453                  //  below the average.
00454                  // For experimental purposes only.
00455                 int qsize = qib_?q_->byteLength():q_->length();
00456                 // pkts: the number of packets arriving in 50 ms
00457                 double pkts = edp_.ptc * 0.05;
00458                 double fraction = pow( (1-edp_.q_w), pkts);
00459                 // double fraction = 0.9;
00460                 if ((double) qsize < fraction * edv_.v_ave) {
00461                         // queue could have been empty for 0.05 seconds
00462                         // printf("fraction: %5.2f\n", fraction);
00463                         return (0);
00464                 }
00465         }
00466         double u = Random::uniform();
00467         if (edp_.cautious == 2) {
00468                 // Decrease the drop probability if the instantaneous
00469                 //   queue is much below the average.
00470                 // For experimental purposes only.
00471                 int qsize = qib_?q_->byteLength():q_->length();
00472                 // pkts: the number of packets arriving in 50 ms
00473                 double pkts = edp_.ptc * 0.05;
00474                 double fraction = pow( (1-edp_.q_w), pkts);
00475                 // double fraction = 0.9;
00476                 double ratio = qsize / (fraction * edv_.v_ave);
00477                 if (ratio < 1.0) {
00478                         // printf("ratio: %5.2f\n", ratio);
00479                         u *= 1.0 / ratio;
00480                 }
00481         }
00482         if (u <= edv_.v_prob) {
00483                 // DROP or MARK
00484                 edv_.count = 0;
00485                 edv_.count_bytes = 0;
00486                 hdr_flags* hf = hdr_flags::access(pickPacketForECN(pkt));
00487                 if (edp_.setbit && hf->ect() && edv_.v_prob1 < edp_.mark_p) { 
00488                         hf->ce() = 1;   // mark Congestion Experienced bit
00489                         // Tell the queue monitor here - call emark(pkt)
00490                         return (0);     // no drop
00491                 } else {
00492                         return (1);     // drop
00493                 }
00494         }
00495         return (0);                     // no DROP/mark
00496 }

Here is the call graph for this function:

void RedPDQueue::enque Packet pkt  )  [protected, virtual]
 

Reimplemented from REDQueue.

Definition at line 121 of file red-pd.cc.

References abort(), hdr_cmn::access(), RedPDFlow::auto_, PacketQueue::byteLength(), edp::bytes, Scheduler::clock(), RedPDFlow::count, RedPDFlow::currentBW_, NsObject::debug_, Connector::drop(), REDQueue::edp_, REDQueue::edv_, REDQueue::enque(), QueueMonitor::estRate_, FlowMon::find(), flowMonitor_, Packet::free(), getP_monFlow(), global_target_, Scheduler::instance(), RedPDFlow::lastDropTime_, PacketQueue::length(), edp::mean_pktsize, MEDTrace, REDQueue::modify_p(), FlowMon::mon_edrop(), RedPDFlow::monitored(), noidle_, P_testFRp_, REDQueue::q_, REDQueue::qib_, Queue< T >::size(), RedPDFlow::targetBW_, targetBW_, edp::th_min, Random::uniform(), RedPDFlow::unresponsive_, unresponsive_penalty_, and edv::v_ave.

00121                                   {
00122         
00123         double P_monFlow=0;
00124 
00125         //      hdr_ip* iph = (hdr_ip*)pkt->access(off_ip_);    
00126         //      int fid = iph->flowid();
00127         //      int src_ = iph->saddr();
00128         
00129         if (flowMonitor_ == NULL) {
00130                 printf("RedPD: ERROR: FlowMonitor Not Found --\n");
00131                 abort();
00132         }       
00133         
00134         RedPDFlow * flow = (RedPDFlow *) flowMonitor_->find(pkt);
00135         
00136         if (flow == NULL) {
00137                 printf("RedPD: ERROR: Flow Not Found\n");
00138                 abort();
00139         }
00140         
00141 //      if (debug_) {
00142 //              printf("flow - %s %d", flow->name(), flow->monitored_);
00143 //              if (flow->monitored()) 
00144 //                      printf("RedPD: Got a monitored flow :)\n");
00145 //              else
00146 //                      printf("RedPD: Unmonitored flow :(\n");
00147 //      }
00148 
00149         if (flow->monitored()) {
00150 
00151                 //update the current estimate 
00152                 //if automatic arrival rate estimation is taking place.
00153                 if (flow->auto_) {
00154                         flow->currentBW_ = flow->estRate_;
00155                 }
00156                 
00157                 //calculate drop probability - use the global target if global_target_ is set
00158                 if (global_target_) { 
00159                         P_monFlow = getP_monFlow(flow->currentBW_, targetBW_);
00160                 } 
00161                 else { 
00162                         P_monFlow = getP_monFlow(flow->currentBW_, flow->targetBW_);
00163                 }
00164                 
00165                 if (flow->unresponsive_) {
00166                         //printf("unresponsive penalty = %g\n", unresponsive_penalty_);
00167                         P_monFlow *= unresponsive_penalty_;
00168                 }
00169                 
00170                 if (P_monFlow != 0) {
00171                         flow->lastDropTime_ = Scheduler::instance().clock();
00172                         double mod_p = modify_p(P_monFlow, flow->count, 0, 0, 0, 0, 0);
00173 
00174                         P_monFlow = mod_p;
00175                         double u = Random::uniform();
00176                         
00177                         int drop=0;
00178                         
00179                         //don't apply link utilization optimization in testFRp mode
00180                         if (P_testFRp_ != -1 && u <= P_monFlow) {
00181                             drop =1;
00182                         }
00183 
00184                         // drop a packet 
00185                         // 1. flow is responsive & (ave_q > min_th) & queue is not empty
00186                         // 2  flow is unresponsive & (noidle is not set or queue is not empty) 
00187                         int qlen = qib_ ? q_->byteLength() : q_->length();
00188                         if ( P_testFRp_ == -1 && u<= P_monFlow &&
00189                              (
00190                               (!flow->unresponsive_ && edv_.v_ave >= edp_.th_min && qlen > 1) ||
00191                               (flow->unresponsive_ && ( qlen > 1 || !noidle_))
00192                               )
00193                              ) {
00194                             drop = 1;
00195                         }
00196 
00197                         if (drop) {
00198                             //first trace the monitored early drop
00199                             if (MEDTrace!= NULL) 
00200                                 ((Trace *)MEDTrace)->recvOnly(pkt);
00201                             
00202                             flowMonitor_->mon_edrop(pkt);
00203                             
00204                             //there is a bug here, this packet drop does not go to
00205                             // any other flow monitor attached to the link. 
00206                             //departures and arrivals still go there if you wanna calculate.
00207                             Packet::free(pkt);
00208                             
00209                             flow->count = 0;
00210                             return;
00211                         }
00212                         else {
00213                             flow->count++;
00214                         }
00215                 }
00216         }
00217         
00218         //if not dropped or a non-monitored packet - send it to the RED queue 
00219         // - but before see if testFRp mode is on
00220         if (P_testFRp_ != -1) {
00221             double p = P_testFRp_;
00222             int size =  (hdr_cmn::access(pkt))->size();
00223             if (edp_.bytes) {
00224                 p = (p * size) / edp_.mean_pktsize;
00225             }
00226             if (debug_) 
00227                 printf("FRp_ mode ON with %g\n",P_testFRp_); 
00228             double u = Random::uniform();
00229             if (u <= p) {
00230                 drop(pkt);
00231                 return;
00232             }
00233         }
00234         
00235         REDQueue::enque(pkt);
00236 }

Here is the call graph for this function:

template<class T>
void Queue< T >::enqueue QueueElem< T > *  e  )  [inline, inherited]
 

Definition at line 369 of file mcache.h.

References QueueElem< T >::append(), Queue< T >::head_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by MediaServer::command(), and MediaServer::get_next_segment().

00369                                       {
00370                 if (tail_ == 0)
00371                         head_ = tail_ = e;
00372                 else {
00373                         tail_->append(e);
00374                         tail_ = e;
00375                 }
00376                 size_++;
00377         }

Here is the call graph for this function:

double REDQueue::estimator int  nqueued,
int  m,
double  ave,
double  q_w
[protected, inherited]
 

Definition at line 319 of file red.cc.

References edp::adaptive, Scheduler::clock(), REDQueue::edp_, REDQueue::edv_, edp::feng_adaptive, Scheduler::instance(), edp::interval, edv::lastset, REDQueue::updateMaxP(), and REDQueue::updateMaxPFeng().

Referenced by RIOQueue::enque(), and REDQueue::enque().

00320 {
00321         double new_ave, old_ave;
00322 
00323         new_ave = ave;
00324         while (--m >= 1) {
00325                 new_ave *= 1.0 - q_w;
00326         }
00327         old_ave = new_ave;
00328         new_ave *= 1.0 - q_w;
00329         new_ave += q_w * nqueued;
00330         
00331         double now = Scheduler::instance().clock();
00332         if (edp_.adaptive == 1) {
00333                 if (edp_.feng_adaptive == 1)
00334                         updateMaxPFeng(new_ave);
00335                 else if (now > edv_.lastset + edp_.interval)
00336                         updateMaxP(new_ave, now);
00337         }
00338         return new_ave;
00339 }

Here is the call graph for this function:

template<class T>
QueueElem<T>* Queue< T >::getHead  )  [inline, inherited]
 

Definition at line 411 of file mcache.h.

References Queue< T >::head_.

Referenced by MediaServer::find_prefinfo().

00411 { return head_; }

double RedPDQueue::getP_monFlow double  current,
double  target
[inline, protected]
 

Definition at line 80 of file red-pd.h.

Referenced by enque().

00080                                                            {
00081                 if (current <= 0 || current < target) 
00082                         return 0; //means don't drop
00083                 // the surviving probability is target/current
00084                 return 1 - (target/current);
00085         }               

void NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093         recv((Packet*)e);
00094 }

Here is the call graph for this function:

void REDQueue::initialize_params  )  [protected, inherited]
 

Definition at line 167 of file red.cc.

References edp::delay, REDQueue::edp_, edp::ptc, edp::q_w, edp::targetdelay, edp::th_max_pkts, and edp::th_min_pkts.

Referenced by REDQueue::command(), and REDQueue::reset().

00168 {
00169 /*
00170  * If q_weight=0, set it to a reasonable value of 1-exp(-1/C)
00171  * This corresponds to choosing q_weight to be of that value for
00172  * which the packet time constant -1/ln(1-q_weight) per default RTT 
00173  * of 100ms is an order of magnitude more than the link capacity, C.
00174  *
00175  * If q_weight=-1, then the queue weight is set to be a function of
00176  * the bandwidth and the link propagation delay.  In particular, 
00177  * the default RTT is assumed to be three times the link delay and 
00178  * transmission delay, if this gives a default RTT greater than 100 ms. 
00179  *
00180  * If q_weight=-2, set it to a reasonable value of 1-exp(-10/C).
00181  */
00182         if (edp_.q_w == 0.0) {
00183                 edp_.q_w = 1.0 - exp(-1.0/edp_.ptc);
00184         } else if (edp_.q_w == -1.0) {
00185                 double rtt = 3.0*(edp_.delay+1.0/edp_.ptc);
00186                 //printf("delay: %5.4f rtt: %5.4f\n", edp_.delay, rtt);
00187                 if (rtt < 0.1) 
00188                         rtt = 0.1;
00189                 edp_.q_w = 1.0 - exp(-1.0/(10*rtt*edp_.ptc));
00190         } else if (edp_.q_w == -2.0) {
00191                 edp_.q_w = 1.0 - exp(-10.0/edp_.ptc);
00192         }
00193 
00194         // printf("ptc: %7.5f bandwidth: %5.3f pktsize: %d\n", edp_.ptc, link_->bandwidth(), edp_.mean_pktsize);
00195         // printf("th_min_pkts: %7.5f th_max_pkts: %7.5f\n", edp_.th_min_pkts, edp_.th_max);
00196         if (edp_.th_min_pkts == 0) {
00197                 edp_.th_min_pkts = 5.0;
00198                 // set th_min_pkts to half of targetqueue, if this is greater
00199                 //  than 5 packets.
00200                 double targetqueue = edp_.targetdelay * edp_.ptc;
00201                 if (edp_.th_min_pkts < targetqueue / 2.0 )
00202                         edp_.th_min_pkts = targetqueue / 2.0 ;
00203         }
00204         if (edp_.th_max_pkts == 0) 
00205                 edp_.th_max_pkts = 3.0 * edp_.th_min_pkts;
00206         //printf("th_min_pkts: %7.5f th_max_pkts: %7.5f\n", edp_.th_min_pkts, edp_.th_max);
00207         //printf("q_w: %7.5f\n", edp_.q_w);
00208 }

template<class T>
int Queue< T >::is_empty  )  const [inline, inherited]
 

Definition at line 412 of file mcache.h.

References Queue< T >::size_.

Referenced by MediaServer::command(), and MediaServer::get_next_segment().

00412 { return (size_ == 0); }

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

template<class T>
int Queue< T >::length  )  [inline, inherited]
 

Reimplemented in DRR, and SRR.

Definition at line 133 of file queue.h.

References PacketQueue::length(), and Queue< T >::pq_.

Referenced by REMQueue::run_updaterule(), Snoop::snoop_data(), and JoBS::updateStats().

00133 { return pq_->length(); }       /* number of pkts currently in

Here is the call graph for this function:

template<class T>
int Queue< T >::limit  )  [inline, inherited]
 

Definition at line 132 of file queue.h.

References Queue< T >::qlim_.

Referenced by dsREDQueue::reset(), and Snoop::snoop_data().

00132 { return qlim_; }

double REDQueue::modify_p double  p,
int  count,
int  count_bytes,
int  bytes,
int  mean_pktsize,
int  wait,
int  size
[protected, inherited]
 

Definition at line 406 of file red.cc.

Referenced by REDQueue::drop_early(), RIOQueue::drop_in_early(), RIOQueue::drop_out_early(), and enque().

00408 {
00409         double count1 = (double) count;
00410         if (bytes)
00411                 count1 = (double) (count_bytes/mean_pktsize);
00412         if (wait) {
00413                 if (count1 * p < 1.0)
00414                         p = 0.0;
00415                 else if (count1 * p < 2.0)
00416                         p /= (2 - count1 * p);
00417                 else
00418                         p = 1.0;
00419         } else {
00420                 if (count1 * p < 1.0)
00421                         p /= (1.0 - count1 * p);
00422                 else
00423                         p = 1.0;
00424         }
00425         if (bytes && p < 1.0) {
00426                 p = p * size / mean_pktsize;
00427         }
00428         if (p > 1.0)
00429                 p = 1.0;
00430         return p;
00431 }

Packet * REDQueue::pickPacketForECN Packet pkt  )  [protected, virtual, inherited]
 

Reimplemented in SemanticREDQueue, and SemanticRIOQueue.

Definition at line 506 of file red.cc.

Referenced by REDQueue::drop_early(), RIOQueue::drop_in_early(), RIOQueue::drop_out_early(), RIOQueue::enque(), and REDQueue::enque().

00507 {
00508         return pkt; /* pick the packet that just arrived */
00509 }

Packet * REDQueue::pickPacketToDrop  )  [protected, virtual, inherited]
 

Reimplemented in SemanticREDQueue, and SemanticRIOQueue.

Definition at line 517 of file red.cc.

References REDQueue::drop_front_, REDQueue::drop_rand_, Random::integer(), PacketQueue::length(), PacketQueue::lookup(), min, and REDQueue::q_.

Referenced by RIOQueue::enque(), and REDQueue::enque().

00518 {
00519         int victim;
00520 
00521         if (drop_front_)
00522                 victim = min(1, q_->length()-1);
00523         else if (drop_rand_)
00524                 victim = Random::integer(q_->length());
00525         else                    /* default is drop_tail_ */
00526                 victim = q_->length() - 1;
00527 
00528         return(q_->lookup(victim)); 
00529 }

Here is the call graph for this function:

void REDQueue::print_edp  )  [protected, inherited]
 

Reimplemented in RIOQueue.

Definition at line 835 of file red.cc.

References edp::bytes, edv::cur_max_p, REDQueue::edp_, REDQueue::edv_, REDQueue::idletime_, edp::mean_pktsize, edp::ptc, edp::q_w, Queue< T >::qlim_, edp::setbit, edp::th_max, edp::th_min, and edp::wait.

Referenced by RIOQueue::print_edp(), and REDQueue::REDQueue().

00836 {
00837         printf("mean_pktsz: %d\n", edp_.mean_pktsize); 
00838         printf("bytes: %d, wait: %d, setbit: %d\n",
00839                 edp_.bytes, edp_.wait, edp_.setbit);
00840         printf("minth: %f, maxth: %f\n", edp_.th_min, edp_.th_max);
00841         printf("max_p: %f, qw: %f, ptc: %f\n",
00842                 (double) edv_.cur_max_p, edp_.q_w, edp_.ptc);
00843         printf("qlim: %d, idletime: %f\n", qlim_, idletime_);
00844         printf("=========\n");
00845 }

void REDQueue::print_edv  )  [protected, inherited]
 

Reimplemented in RIOQueue.

Definition at line 847 of file red.cc.

References REDQueue::edv_, edv::v_a, and edv::v_b.

Referenced by RIOQueue::print_edv(), and REDQueue::REDQueue().

00848 {
00849         printf("v_a: %f, v_b: %f\n", edv_.v_a, edv_.v_b);
00850 }

void REDQueue::print_summarystats  )  [protected, inherited]
 

Definition at line 852 of file red.cc.

References REDQueue::qib_, Queue< T >::total_time_, and Queue< T >::true_ave_.

Referenced by REDQueue::command().

00853 {
00854         //double now = Scheduler::instance().clock();
00855         printf("True average queue: %5.3f", true_ave_);
00856         if (qib_) 
00857                 printf(" (in bytes)");
00858         printf(" time: %5.3f\n", total_time_);
00859 }

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

00097 {
00098         Packet::free(p);
00099 }

Here is the call graph for this function:

template<class T>
void Queue< T >::recv Packet ,
Handler
[virtual, inherited]
 

Reimplemented from Connector.

Reimplemented in CBQueue, FQ, and PriQueue.

Definition at line 101 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Queue< T >::enque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, and Queue< T >::utilUpdate().

Referenced by PriQueue::recv().

00102 {
00103         double now = Scheduler::instance().clock();
00104         enque(p);
00105         if (!blocked_) {
00106                 /*
00107                  * We're not blocked.  Get a packet and send it on.
00108                  * We perform an extra check because the queue
00109                  * might drop the packet even if it was
00110                  * previously empty!  (e.g., RED can do this.)
00111                  */
00112                 p = deque();
00113                 if (p != 0) {
00114                         utilUpdate(last_change_, now, blocked_);
00115                         last_change_ = now;
00116                         blocked_ = 1;
00117                         target_->recv(p, &qh_);
00118                 }
00119         }
00120 }

Here is the call graph for this function:

virtual void NsObject::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented in Agent, and Trace.

Definition at line 56 of file object.h.

Referenced by Trace::recvOnly().

00056 {};

virtual void REDQueue::reportDrop Packet pkt  )  [inline, protected, virtual, inherited]
 

Reimplemented in PushbackQueue.

Definition at line 159 of file red.h.

Referenced by REDQueue::enque().

00159 {}  //pushback

void RedPDQueue::reset  )  [protected, virtual]
 

Reimplemented from REDQueue.

Definition at line 104 of file red-pd.cc.

References REDQueue::reset().

00104                        {
00105 
00106         REDQueue::reset();
00107         
00108         //probably should also reset the attached flow monitor and all the flows in it.
00109 }

Here is the call graph for this function:

template<class T>
void Queue< T >::resume  )  [inherited]
 

Definition at line 154 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, Queue< T >::unblock_on_resume_, and Queue< T >::utilUpdate().

Referenced by WRR_CBQueue::deque(), CBQueue::deque(), and QueueHandler::handle().

00155 {
00156         double now = Scheduler::instance().clock();
00157         Packet* p = deque();
00158         if (p != 0) {
00159                 target_->recv(p, &qh_);
00160         } else {
00161                 if (unblock_on_resume_) {
00162                         utilUpdate(last_change_, now, blocked_);
00163                         last_change_ = now;
00164                         blocked_ = 0;
00165                 }
00166                 else {
00167                         utilUpdate(last_change_, now, blocked_);
00168                         last_change_ = now;
00169                         blocked_ = 1;
00170                 }
00171         }
00172 }

Here is the call graph for this function:

void REDQueue::run_estimator int  nqueued,
int  m
[protected, inherited]
 

Definition at line 872 of file red.cc.

References REDQueue::edp_, REDQueue::edv_, edp::q_w, edv::v_ave, and edv::v_slope.

00873 {
00874         double f, f_sl, f_old;
00875 
00876         f = edv_.v_ave;
00877         f_sl = edv_.v_slope;
00878 #define RED_EWMA
00879 #ifdef RED_EWMA
00880         while (--m >= 1) {
00881                 f_old = f;
00882                 f *= 1.0 - edp_.q_w;
00883         }
00884         f_old = f;
00885         f *= 1.0 - edp_.q_w;
00886         f += edp_.q_w * nqueued;
00887 #endif
00888 #ifdef RED_HOLT_WINTERS
00889         while (--m >= 1) {
00890                 f_old = f;
00891                 f += f_sl;
00892                 f *= 1.0 - edp_.q_w;
00893                 f_sl *= 1.0 - 0.5 * edp_.q_w;
00894                 f_sl += 0.5 * edp_.q_w * (f - f_old);
00895         }
00896         f_old = f;
00897         f += f_sl;
00898         f *= 1.0 - edp_.q_w;
00899         f += edp_.q_w * nqueued;
00900         f_sl *= 1.0 - 0.5 * edp_.q_w;
00901         f_sl += 0.5 * edp_.q_w * (f - f_old);
00902 #endif
00903         edv_.v_ave = f;
00904         edv_.v_slope = f_sl;
00905 }

void Connector::send Packet p,
Handler h
[inline, protected, inherited]
 

Reimplemented in Agent, and LinkDelay.

Definition at line 54 of file connector.h.

References NsObject::recv(), and Connector::target_.

Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().

00054 { target_->recv(p, h); }

Here is the call graph for this function:

void RedPDQueue::setFlowMon FlowMon flowMon  )  [inline]
 

Definition at line 65 of file red-pd.h.

References flowMonitor_.

00065                                            {
00066                 flowMonitor_ = flowMon;
00067         }

template<class T>
int Queue< T >::size  )  const [inline, inherited]
 

Definition at line 413 of file mcache.h.

References Queue< T >::size_.

Referenced by JoBS::arvAccounting(), JoBS::assignRateDropsADC(), dsREDQueue::deque(), JoBS::dropFront(), JoBS::dropTail(), enque(), JoBS::enque(), MediaServer::get_next_segment(), JoBS::pickDroppedRLC(), and FQ::recv().

00413 { return size_; }

NsObject* Connector::target  )  [inline, inherited]
 

Definition at line 48 of file connector.h.

References Connector::target_.

Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().

00048 { return target_; }

void REDQueue::trace TracedVar *   )  [protected, inherited]
 

Reimplemented in RIOQueue.

Definition at line 803 of file red.cc.

References Scheduler::clock(), Scheduler::instance(), and REDQueue::tchan_.

Referenced by REDQueue::REDQueue().

00804 {
00805         char wrk[500], *p;
00806 
00807         if (((p = strstr(v->name(), "ave")) == NULL) &&
00808             ((p = strstr(v->name(), "prob")) == NULL) &&
00809             ((p = strstr(v->name(), "curq")) == NULL) &&
00810             ((p = strstr(v->name(), "cur_max_p"))==NULL) ) {
00811                 fprintf(stderr, "RED:unknown trace var %s\n",
00812                         v->name());
00813                 return;
00814         }
00815 
00816         if (tchan_) {
00817                 int n;
00818                 double t = Scheduler::instance().clock();
00819                 // XXX: be compatible with nsv1 RED trace entries
00820                 if (strstr(v->name(), "curq") != NULL) {
00821                         sprintf(wrk, "Q %g %d", t, int(*((TracedInt*) v)));
00822                 } else {
00823                         sprintf(wrk, "%c %g %g", *p, t,
00824                                 double(*((TracedDouble*) v)));
00825                 }
00826                 n = strlen(wrk);
00827                 wrk[n] = '\n'; 
00828                 wrk[n+1] = 0;
00829                 (void)Tcl_Write(tchan_, wrk, n+1);
00830         }
00831         return; 
00832 }

Here is the call graph for this function:

template<class T>
void Queue< T >::unblock  )  [inline, inherited]
 

Definition at line 130 of file queue.h.

References Queue< T >::blocked_.

00130 { blocked_ = 0; }

void REDQueue::updateMaxP double  new_ave,
double  now
[protected, inherited]
 

Definition at line 297 of file red.cc.

References edp::alpha, edp::beta, edp::bottom, edv::cur_max_p, REDQueue::edp_, REDQueue::edv_, edv::lastset, edp::th_max, edp::th_min, and edp::top.

Referenced by REDQueue::estimator().

00298 {
00299         double part = 0.4*(edp_.th_max - edp_.th_min);
00300         // AIMD rule to keep target Q~1/2(th_min+th_max)
00301         if ( new_ave < edp_.th_min + part && edv_.cur_max_p > edp_.bottom) {
00302                 // we increase the average queue size, so decrease max_p
00303                 edv_.cur_max_p = edv_.cur_max_p * edp_.beta;
00304                 edv_.lastset = now;
00305         } else if (new_ave > edp_.th_max - part && edp_.top > edv_.cur_max_p ) {
00306                 // we decrease the average queue size, so increase max_p
00307                 double alpha = edp_.alpha;
00308                         if ( alpha > 0.25*edv_.cur_max_p )
00309                         alpha = 0.25*edv_.cur_max_p;
00310                 edv_.cur_max_p = edv_.cur_max_p + alpha;
00311                 edv_.lastset = now;
00312         } 
00313 }

void REDQueue::updateMaxPFeng double  new_ave  )  [protected, inherited]
 

Definition at line 274 of file red.cc.

References edv::Above, edp::alpha, edv::Below, edp::beta, edv::Between, edv::cur_max_p, REDQueue::edp_, REDQueue::edv_, edv::status, edp::th_max, and edp::th_min.

Referenced by REDQueue::estimator().

00275 {
00276         if ( edp_.th_min < new_ave && new_ave < edp_.th_max) {
00277                 edv_.status = edv_.Between;
00278         }
00279         if (new_ave < edp_.th_min && edv_.status != edv_.Below) {
00280                 edv_.status = edv_.Below;
00281                 edv_.cur_max_p = edv_.cur_max_p / edp_.alpha;
00282                 //double max = edv_.cur_max_p; double param = edp_.alpha;
00283                 //printf("max: %5.2f alpha: %5.2f\n", max, param);
00284         }
00285         if (new_ave > edp_.th_max && edv_.status != edv_.Above) {
00286                 edv_.status = edv_.Above;
00287                 edv_.cur_max_p = edv_.cur_max_p * edp_.beta;
00288                 //double max = edv_.cur_max_p; double param = edp_.alpha;
00289                 //printf("max: %5.2f beta: %5.2f\n", max, param);
00290         }
00291 }

template<class T>
void Queue< T >::updateStats int  queuesize  )  [virtual, inherited]
 

Definition at line 141 of file queue.cc.

References Scheduler::clock(), Scheduler::instance(), Queue< T >::total_time_, and Queue< T >::true_ave_.

Referenced by REDQueue::deque(), DropTail::deque(), REDQueue::enque(), and DropTail::enque().

00142 {
00143         double now = Scheduler::instance().clock();
00144         double newtime = now - total_time_;
00145         if (newtime > 0.0) {
00146                 double oldave = true_ave_;
00147                 double oldtime = total_time_;
00148                 double newtime = now - total_time_;
00149                 true_ave_ = (oldtime * oldave + newtime * queuesize) /now;
00150                 total_time_ = now;
00151         }
00152 }

Here is the call graph for this function:

template<class T>
double Queue< T >::utilization void   )  [virtual, inherited]
 

Definition at line 130 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::old_util_, and Queue< T >::utilUpdate().

Referenced by QSAgent::recv().

00131 {
00132         double now = Scheduler::instance().clock();
00133         
00134         utilUpdate(last_change_, now, blocked_);
00135         last_change_ = now;
00136 
00137         return old_util_;
00138                         
00139 }

Here is the call graph for this function:

template<class T>
void Queue< T >::utilUpdate double  int_begin,
double  int_end,
int  link_state
[protected, inherited]
 

Definition at line 122 of file queue.cc.

References Queue< T >::old_util_, and Queue< T >::util_weight_.

Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization().

00122                                                                        {
00123 double decay;
00124 
00125         decay = exp(-util_weight_ * (int_end - int_begin));
00126         old_util_ = link_state + (old_util_ - link_state) * decay;
00127 
00128 }


Member Data Documentation

int RedPDQueue::auto_
 

Definition at line 52 of file red-pd.h.

Referenced by command(), and RedPDQueue().

template<class T>
int Queue< T >::blocked_ [protected, inherited]
 

Definition at line 143 of file queue.h.

Referenced by Queue< T >::block(), Queue< T >::blocked(), Queue< T >::Queue(), Queue< T >::recv(), FQ::recv(), CBQueue::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), CBQueue::sched(), Queue< T >::unblock(), and Queue< T >::utilization().

TracedInt REDQueue::curq_ [protected, inherited]
 

Definition at line 179 of file red.h.

Referenced by RIOQueue::enque(), REDQueue::enque(), and REDQueue::REDQueue().

NsObject* REDQueue::de_drop_ [protected, inherited]
 

Definition at line 170 of file red.h.

Referenced by REDQueue::command(), command(), RIOQueue::enque(), and REDQueue::enque().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

int REDQueue::doubleq_ [protected, inherited]
 

Definition at line 192 of file red.h.

int REDQueue::dqthresh_ [protected, inherited]
 

Definition at line 193 of file red.h.

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv().

int REDQueue::drop_front_ [protected, inherited]
 

Definition at line 186 of file red.h.

Referenced by REDQueue::pickPacketToDrop(), and REDQueue::REDQueue().

int REDQueue::drop_rand_ [protected, inherited]
 

Definition at line 187 of file red.h.

Referenced by REDQueue::pickPacketToDrop(), and REDQueue::REDQueue().

int REDQueue::drop_tail_ [protected, inherited]
 

Definition at line 185 of file red.h.

Referenced by REDQueue::REDQueue().

edp REDQueue::edp_ [protected, inherited]
 

Definition at line 191 of file red.h.

Referenced by REDQueue::command(), REDQueue::drop_early(), RIOQueue::drop_in_early(), RIOQueue::drop_out_early(), RIOQueue::enque(), REDQueue::enque(), enque(), PushbackQueue::enque(), REDQueue::estimator(), REDQueue::initialize_params(), REDQueue::print_edp(), REDQueue::REDQueue(), RIOQueue::reset(), REDQueue::reset(), REDQueue::run_estimator(), REDQueue::updateMaxP(), and REDQueue::updateMaxPFeng().

NsObject* REDQueue::EDTrace [protected, inherited]
 

Definition at line 174 of file red.h.

Referenced by REDQueue::command(), and REDQueue::enque().

edv REDQueue::edv_ [protected, inherited]
 

Definition at line 200 of file red.h.

Referenced by REDQueue::drop_early(), RIOQueue::drop_out_early(), RIOQueue::enque(), REDQueue::enque(), enque(), PushbackQueue::enque(), REDQueue::estimator(), REDQueue::print_edp(), REDQueue::print_edv(), REDQueue::REDQueue(), REDQueue::reset(), REDQueue::run_estimator(), REDQueue::updateMaxP(), and REDQueue::updateMaxPFeng().

int REDQueue::fifo_ [protected, inherited]
 

Definition at line 164 of file red.h.

int REDQueue::first_reset_ [protected, inherited]
 

Definition at line 201 of file red.h.

FlowMon* RedPDQueue::flowMonitor_ [protected]
 

Definition at line 76 of file red-pd.h.

Referenced by command(), enque(), and setFlowMon().

int RedPDQueue::global_target_
 

Definition at line 54 of file red-pd.h.

Referenced by enque(), and RedPDQueue().

template<class T>
QueueElem<T>* Queue< T >::head_ [protected, inherited]
 

Definition at line 416 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::destroy(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::getHead(), Queue< T >::Queue(), Queue< T >::reset(), and Queue< T >::~Queue().

int REDQueue::idle_ [protected, inherited]
 

Definition at line 198 of file red.h.

Referenced by REDQueue::deque(), RIOQueue::enque(), REDQueue::enque(), and REDQueue::reset().

double REDQueue::idletime_ [protected, inherited]
 

Definition at line 199 of file red.h.

Referenced by REDQueue::deque(), RIOQueue::enque(), REDQueue::enque(), REDQueue::print_edp(), and REDQueue::reset().

template<class T>
double Queue< T >::last_change_ [protected, inherited]
 

Definition at line 154 of file queue.h.

Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization().

LinkDelay* REDQueue::link_ [protected, inherited]
 

Definition at line 163 of file red.h.

Referenced by REDQueue::command(), PushbackQueue::getBW(), REDQueue::reset(), and PushbackQueue::timeout().

NsObject* RedPDQueue::MEDTrace [protected]
 

Definition at line 78 of file red-pd.h.

Referenced by command(), and enque().

char RedPDQueue::medTraceType[20] [protected]
 

Definition at line 77 of file red-pd.h.

Referenced by command(), and RedPDQueue().

int RedPDQueue::noidle_
 

Definition at line 62 of file red-pd.h.

Referenced by enque(), and RedPDQueue().

int RedPDQueue::noMonitored_
 

Definition at line 57 of file red-pd.h.

Referenced by command(), and RedPDQueue().

int REDQueue::ns1_compat_ [protected, inherited]
 

Definition at line 188 of file red.h.

Referenced by RIOQueue::enque(), REDQueue::enque(), and REDQueue::REDQueue().

int RedPDQueue::off_ip_ [protected]
 

Definition at line 74 of file red-pd.h.

Referenced by RedPDQueue().

template<class T>
double Queue< T >::old_util_ [protected, inherited]
 

Definition at line 155 of file queue.h.

Referenced by Queue< T >::utilization(), and Queue< T >::utilUpdate().

double RedPDQueue::P_testFRp_
 

Definition at line 61 of file red-pd.h.

Referenced by enque(), and RedPDQueue().

template<class T>
PacketQueue* Queue< T >::pq_ [protected, inherited]
 

Definition at line 146 of file queue.h.

Referenced by Queue< T >::byteLength(), Vq::command(), REMQueue::command(), REDQueue::command(), PIQueue::command(), GK::command(), DropTail::command(), DropTail::DropTail(), GK::GK(), Queue< T >::length(), SemanticRIOQueue::pickPacketForECN(), SemanticREDQueue::pickPacketForECN(), SemanticRIOQueue::pickPacketToDrop(), SemanticREDQueue::pickPacketToDrop(), PIQueue::PIQueue(), REDQueue::REDQueue(), REMQueue::REMQueue(), and Vq::Vq().

PacketQueue* REDQueue::q_ [protected, inherited]
 

Definition at line 165 of file red.h.

Referenced by REDQueue::bcount_(), REDQueue::command(), REDQueue::deque(), REDQueue::drop_early(), RIOQueue::enque(), REDQueue::enque(), enque(), PushbackQueue::enque(), REDQueue::pickPacketToDrop(), and REDQueue::REDQueue().

template<class T>
QueueHandler Queue< T >::qh_ [protected, inherited]
 

Definition at line 145 of file queue.h.

Referenced by Queue< T >::recv(), FQ::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), and CBQueue::sched().

int REDQueue::qib_ [protected, inherited]
 

Definition at line 169 of file red.h.

Referenced by REDQueue::deque(), REDQueue::drop_early(), RIOQueue::enque(), REDQueue::enque(), enque(), PushbackQueue::enque(), REDQueue::print_summarystats(), REDQueue::REDQueue(), RIOQueue::reset(), and REDQueue::reset().

template<class T>
int Queue< T >::qlim_ [protected, inherited]
 

Definition at line 142 of file queue.h.

Referenced by Vq::checkPacketForECN(), Vq::enque(), SRR::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), PIQueue::enque(), Marker::enque(), JoBS::enque(), GK::enque(), DropTail::enque(), Demarker::enque(), Queue< T >::limit(), RIOQueue::print_edp(), REDQueue::print_edp(), Queue< T >::Queue(), and PriQueue::recvHighPriority().

template<class T>
int Queue< T >::size_ [protected, inherited]
 

Definition at line 417 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::is_empty(), Queue< T >::Queue(), and Queue< T >::size().

int REDQueue::summarystats_ [protected, inherited]
 

Definition at line 161 of file red.h.

Referenced by REDQueue::deque(), REDQueue::enque(), and REDQueue::REDQueue().

template<class T>
QueueElem<T> * Queue< T >::tail_ [protected, inherited]
 

Definition at line 416 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), and Queue< T >::Queue().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 of file connector.h.

Referenced by SRAgent::command(), SA_Agent::command(), IvsReceiver::command(), MultiFieldFilter::command(), Filter::command(), Connector::command(), DiffusionAgent::DiffusionAgent(), DSRAgent::DSRAgent(), PromotionTimer::expire(), FloodingAgent::FloodingAgent(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSRAgent::handlePacketReceipt(), DSDV_Agent::helper_callback(), AODV::initialized(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SatDequeTrace::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), MIPEncapsulator::recv(), LmsAgent::recv(), HackLossyLink::recv(), GAFPartner::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DynamicLink::recv(), DumbAgent::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), PriQueue::recvHighPriority(), Trace::recvOnly(), TapAgent::recvpkt(), Queue< T >::resume(), LinkDelay::send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), LmsSender::solicit_naks(), Connector::target(), TBF::timeout(), and toraAgent::tora_output().

double RedPDQueue::targetBW_
 

Definition at line 56 of file red-pd.h.

Referenced by enque(), and RedPDQueue().

Tcl_Channel REDQueue::tchan_ [protected, inherited]
 

Definition at line 178 of file red.h.

Referenced by REDQueue::command(), RIOQueue::trace(), and REDQueue::trace().

template<class T>
double Queue< T >::total_time_ [protected, inherited]
 

Definition at line 150 of file queue.h.

Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats().

char REDQueue::traceType[20] [protected, inherited]
 

Definition at line 175 of file red.h.

Referenced by REDQueue::command(), and REDQueue::REDQueue().

template<class T>
double Queue< T >::true_ave_ [protected, inherited]
 

Definition at line 149 of file queue.h.

Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats().

template<class T>
int Queue< T >::unblock_on_resume_ [protected, inherited]
 

Definition at line 144 of file queue.h.

Referenced by Queue< T >::Queue(), and Queue< T >::resume().

double RedPDQueue::unresponsive_penalty_
 

Definition at line 58 of file red-pd.h.

Referenced by enque(), and RedPDQueue().

template<class T>
double Queue< T >::util_weight_ [protected, inherited]
 

Definition at line 156 of file queue.h.

Referenced by Queue< T >::Queue(), and Queue< T >::utilUpdate().


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