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

WRR_CBQueue Class Reference

Inheritance diagram for WRR_CBQueue:

Inheritance graph
[legend]
Collaboration diagram for WRR_CBQueue:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 WRR_CBQueue ()
void addallot (int prio, double diff)
void reset ()
void enque (Packet *)
void recv (Packet *, Handler *)
virtual void recv (Packet *p, const char *s)
LinkDelaylink () const
CBQClasslevel (int n) const
Packetpending_pkt () const
void sched ()
int toplevel ()
void toplevel_arrival (CBQClass *, double)
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,...)

Protected Types

enum  eligible_type_ { NONE, FORMAL, ANCESTORS, TOPLEVEL }

Protected Member Functions

Packetdeque ()
int insert_class (CBQClass *)
void setM ()
int command (int argc, const char *const *argv)
int algorithm (const char *)
int send_permitted (CBQClass *, double)
CBQClassfind_lender (CBQClass *, double)
void toplevel_departure (CBQClass *, double)
int eligible_formal (CBQClass *, double)
int eligible_ancestors (CBQClass *, double)
int eligible_toplevel (CBQClass *cl, double)
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

double alloc_ [MAXPRIO]
double M_ [MAXPRIO]
int cnt_ [MAXPRIO]
Event intr_
CBQClasslast_lender_
Packetpending_pkt_
LinkDelaylink_
CBQClassactive_ [MAXPRIO]
CBQClasslevels_ [MAXLEVEL+1]
int maxprio_
int maxpkt_
int maxlevel_
int toplevel_
eligible_type_ eligible_
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_

Member Enumeration Documentation

enum CBQueue::eligible_type_ [protected, inherited]
 

Enumeration values:
NONE 
FORMAL 
ANCESTORS 
TOPLEVEL 

Definition at line 175 of file cbq.cc.

00175 { NONE, FORMAL, ANCESTORS, TOPLEVEL };


Constructor & Destructor Documentation

WRR_CBQueue::WRR_CBQueue  )  [inline]
 

Definition at line 606 of file cbq.cc.

References alloc_, cnt_, and M_.

00606                       {
00607                 memset(M_, '\0', sizeof(M_));
00608                 memset(alloc_, '\0', sizeof(alloc_));
00609                 memset(cnt_, '\0', sizeof(cnt_));
00610         }


Member Function Documentation

void WRR_CBQueue::addallot int  prio,
double  diff
[inline, virtual]
 

Reimplemented from CBQueue.

Definition at line 611 of file cbq.cc.

References alloc_, and setM().

00611                                                 {
00612                 alloc_[prio] += diff;
00613                 setM();
00614         }

Here is the call graph for this function:

int CBQueue::algorithm const char *   )  [protected, inherited]
 

Definition at line 247 of file cbq.cc.

References CBQueue::ANCESTORS, CBQueue::eligible_, CBQueue::FORMAL, and CBQueue::TOPLEVEL.

Referenced by CBQueue::command().

00248 {
00249 
00250         if (*arg == '0' || (strcmp(arg, "ancestor-only") == 0)) {
00251 //              eligible_ = &eligible_ancestors;
00252                 eligible_ = ANCESTORS;
00253                 return (1);
00254         } else if (*arg == '1' || (strcmp(arg, "top-level") == 0)) {
00255 //              eligible_ = &eligible_toplevel;
00256                 eligible_ = TOPLEVEL;
00257                 return (1);
00258         } else if (*arg == '2' || (strcmp(arg, "formal") == 0)) {
00259 //              eligible_ = &eligible_formal;
00260                 eligible_ = FORMAL;
00261                 return (1);
00262         } else if (*arg == '3' || (strcmp(arg, "old-formal") == 0)) {
00263                 fprintf(stderr, "CBQ: old-formal LS not supported\n");
00264                 return (-1);
00265         }
00266         return (-1);
00267 }

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:

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

Reimplemented from CBQueue.

Definition at line 633 of file cbq.cc.

References CBQueue::command(), and insert_class().

00634 {
00635         Tcl& tcl = Tcl::instance();
00636         if (strcmp(argv[1], "insert-class") == 0) {
00637                 CBQClass *cl = (CBQClass*)TclObject::lookup(argv[2]);
00638                 if (cl == 0) {
00639                         tcl.resultf("WRR-CBQ: no class object %s",
00640                                 argv[2]);
00641                         return (TCL_ERROR);
00642                 }
00643                 if (insert_class(cl) < 0) {
00644                         tcl.resultf("WRR-CBQ: trouble inserting class %s",
00645                                 argv[2]);
00646                         return (TCL_ERROR);
00647                 }
00648                 return (TCL_OK);
00649         }
00650         return (CBQueue::command(argc, argv));
00651 }

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 * WRR_CBQueue::deque  )  [protected, virtual]
 

Reimplemented from CBQueue.

Definition at line 654 of file cbq.cc.

References hdr_cmn::access(), CBQueue::active_, CBQClass::allotment_, CBQClass::bytes_alloc_, Scheduler::clock(), CBQClass::delayed(), CBQClass::demand(), Scheduler::instance(), CBQClass::lender_, M_, CBQueue::maxprio_, CBQClass::peer_, CBQueue::pending_pkt_, CBQClass::permit_borrowing_, CBQClass::pri_, CBQClass::q_, Queue< T >::resume(), CBQueue::send_permitted(), hdr_cmn::size(), CBQueue::toplevel(), CBQueue::toplevel_departure(), and CBQClass::update().

00655 {
00656 
00657         double now = Scheduler::instance().clock();
00658 
00659         CBQClass* first = NULL;
00660         CBQClass* eligible = NULL;
00661         CBQClass* next_eligible = NULL;
00662         CBQClass* cl;
00663 
00664         register int prio;
00665         int deficit, done;
00666         int none_found = 0;
00667 
00668         Packet* rval;
00669 
00670         /*
00671          * prio runs from 0 .. maxprio_
00672          *
00673          * round-robin through all the classes at priority 'prio'
00674          *      if any class is ok to send, resume it's queue
00675          * go on to next lowest priority (higher prio nuber) and repeat
00676          * [lowest priority number is the highest priority]
00677          */
00678 
00679         for (prio = 0; prio <= maxprio_; prio++) {
00680                 // see if there is any class at this prio
00681                 if ((cl = active_[prio]) == NULL) {
00682                         // nobody at this prio level
00683                         continue;
00684                 }
00685                 /* 
00686                  * The WRR round for this priority level starts at deficit 0.
00687                  *  The round ends if some class is found that is ready
00688                  *  to send and has positive "bytes_alloc_".
00689                  * Status advances to deficit 1 if some class was found  
00690                  *  that was able to send except for insufficient
00691                  *  "bytes_alloc_".
00692                  * If status was deficit 1 at the end of the first round,
00693                  *  then status advances to deficit 2.
00694                  * Another round of WRR is then begun at deficit 2, looking
00695                  *  for a class to send even with insufficient "bytes_alloc_".
00696                  */
00697                 deficit = done = 0;
00698                 while (!done) {
00699                         // look for class at this priority level ok to send
00700                         do {
00701                                 // set up "weight" for WRR
00702                                 if (deficit < 2 && cl->bytes_alloc_ <= 0)
00703                                         cl->bytes_alloc_ +=
00704                                                 (int)(cl->allotment_ * M_[cl->pri_]);
00705                                 // anything to send?
00706                                 if (cl->demand()) {
00707                                         if (first == NULL && cl->permit_borrowing_ && cl->lender_ != NULL)
00708                                                 first = cl;
00709                                         if (!send_permitted(cl, now)) {
00710                                                 // not ok to send right now
00711                                                 cl->delayed(now);
00712                                         } else {
00713                                                 // ok to send, if class has
00714                                                 //  enough "weight" for WRR.
00715                                                 int bytes = cl->bytes_alloc_;
00716                                                 if (bytes > 0 || deficit > 1) {
00717                                                         eligible = cl;
00718                                                         goto found;
00719                                                 } else
00720                                                         deficit = 1;
00721                                         }
00722                                 }
00723                                 cl->bytes_alloc_ = 0;
00724                                 cl = cl->peer_;
00725                         } while (cl != active_[prio] && cl != 0);
00726                         if (deficit == 1)
00727                                 deficit = 2;
00728                         else
00729                                 done = 1;
00730                 }
00731         }
00732         // did not find anyone so let first go
00733         if ((eligible == NULL) && first != NULL) {
00734                 none_found = 1;
00735                 eligible = first;
00736         }
00737 
00738 found:
00739         // do accounting
00740         if (eligible != NULL) {
00741                 next_eligible = eligible->peer_;
00742                 eligible->q_->resume();
00743                 if (pending_pkt_ != NULL && !none_found) {
00744                         // reduce our alloc
00745                         // by the packet size.  If we're
00746                         // still positive, we get to go again
00747                         int bytes = eligible->bytes_alloc_;
00748                         hdr_cmn* hdr = hdr_cmn::access(pending_pkt_);
00749                         if (bytes > 0) {
00750                                 eligible->bytes_alloc_ -= hdr->size();
00751                         }
00752                         bytes = eligible->bytes_alloc_;
00753                         if (bytes > 0) {
00754                                 next_eligible = eligible;
00755                         }
00756                         eligible->update(pending_pkt_, now);
00757                         if (toplevel())
00758                                 toplevel_departure(eligible, now);
00759                 }
00760                 active_[eligible->pri_] = next_eligible;
00761         }
00762         rval = pending_pkt_;
00763         pending_pkt_ = NULL;
00764 
00765         return (rval);
00766 }

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(), RedPDQueue::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 CBQueue::eligible_ancestors CBQClass ,
double 
[inline, protected, inherited]
 

Definition at line 178 of file cbq.cc.

Referenced by CBQueue::find_lender().

00178 { return (1); }

int CBQueue::eligible_formal CBQClass ,
double 
[protected, inherited]
 

Definition at line 464 of file cbq.cc.

References LEAF_LEVEL, CBQueue::level(), CBQClass::level_, CBQClass::level_peer_, CBQueue::levels_, and CBQClass::satisfied().

Referenced by CBQueue::find_lender().

00465 {
00466         int level;
00467         CBQClass *p;
00468 
00469         // check from leaf level to (cl->level - 1)
00470         for (level = LEAF_LEVEL; level < cl->level_; level++) {
00471                 p = levels_[level];
00472                 while (p != NULL) {
00473                         if (!p->satisfied(now))
00474                                 return (0);
00475                         p = p->level_peer_;
00476                 }
00477         }
00478         return (1);
00479 }

Here is the call graph for this function:

int CBQueue::eligible_toplevel CBQClass cl,
double 
[inline, protected, inherited]
 

Definition at line 179 of file cbq.cc.

References CBQClass::level_, and CBQueue::toplevel_.

Referenced by CBQueue::find_lender().

00179                                                         {
00180                 return(cl->level_ <= toplevel_);
00181         }

void CBQueue::enque Packet  )  [inline, virtual, inherited]
 

Implements Queue< T >.

Definition at line 140 of file cbq.cc.

References abort().

00140 { abort(); }

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:

CBQClass * CBQueue::find_lender CBQClass ,
double 
[protected, inherited]
 

Definition at line 413 of file cbq.cc.

References abort(), CBQueue::ANCESTORS, CBQueue::eligible_, CBQueue::eligible_ancestors(), CBQueue::eligible_formal(), CBQueue::eligible_toplevel(), CBQueue::FORMAL, CBQClass::lender_, CBQClass::level_, CBQClass::permit_borrowing_, CBQueue::TOPLEVEL, CBQueue::toplevel(), CBQueue::toplevel_, and CBQClass::undertime_.

Referenced by CBQueue::send_permitted().

00414 {
00415         if ((!cl->permit_borrowing_) || ((cl = cl->lender_) == NULL))
00416                 return (NULL);          // no ancestor to borrow from
00417 
00418         while (cl != NULL) {
00419                 // skip past overlimit ancestors
00420                 //      if using TL and we're above the TL limit
00421                 //      do early out
00422                 if (cl->undertime_ > now) {
00423                         if (toplevel() && cl->level_ > toplevel_)
00424                                 return (NULL);
00425                         cl = cl->lender_;
00426                         continue;
00427                 }
00428 
00429                 // found what may be an eligible
00430                 // lender, check using per-algorithm eligibility
00431                 // criteria
00432                 // XXX we explicitly invoke this indirect method with
00433                 // the "this" pointer because MS VC++ can't parse it
00434                 // without it...
00435 //              if ((this->*eligible_)(cl, now))
00436 //                      return (cl);
00437                 switch (eligible_) {
00438                 case TOPLEVEL:
00439                         if (eligible_toplevel(cl, now))
00440                                 return (cl);
00441                         break;
00442                 case ANCESTORS:
00443                         if (eligible_ancestors(cl, now))
00444                                 return (cl);
00445                         break;
00446                 case FORMAL:
00447                         if (eligible_formal(cl, now))
00448                                 return (cl);
00449                         break;
00450                 default:
00451                         fprintf(stderr, "Wrong eligible_\n");
00452                         abort();
00453                 }
00454                 cl = cl->lender_;
00455         }
00456         return (cl);
00457 }

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_; }

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:

int WRR_CBQueue::insert_class CBQClass  )  [protected, virtual]
 

Reimplemented from CBQueue.

Definition at line 769 of file cbq.cc.

References cnt_, CBQueue::insert_class(), CBQClass::pri_, and setM().

Referenced by command().

00770 {
00771         if (CBQueue::insert_class(p) < 0)
00772                 return (-1);
00773         ++cnt_[p->pri_];
00774         setM();
00775         return (0);
00776 }

Here is the call graph for this function:

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:

CBQClass* CBQueue::level int  n  )  const [inline, inherited]
 

Definition at line 143 of file cbq.cc.

References CBQueue::levels_.

Referenced by CBQClass::desc_with_demand(), and CBQueue::eligible_formal().

00143 { return levels_[n]; }

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_; }

LinkDelay* CBQueue::link  )  const [inline, inherited]
 

Definition at line 142 of file cbq.cc.

References CBQueue::link_.

Referenced by CBQClass::newallot(), and CBQClass::update().

00142 { return (link_); }

Packet* CBQueue::pending_pkt  )  const [inline, inherited]
 

Definition at line 147 of file cbq.cc.

References CBQueue::pending_pkt_.

00147 { return (pending_pkt_); }

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:

void CBQueue::recv Packet ,
Handler
[virtual, inherited]
 

Reimplemented from Queue< T >.

Definition at line 228 of file cbq.cc.

References abort(), Queue< T >::blocked_, and CBQueue::pending_pkt_.

00229 {
00230 
00231         if (pending_pkt_ != NULL)
00232                 abort();
00233 
00234         blocked_ = 1;
00235         pending_pkt_ = p;
00236 }

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

void CBQueue::reset  )  [virtual, inherited]
 

Reimplemented from Queue< T >.

Definition at line 239 of file cbq.cc.

00240 {
00241         // don't do anything
00242         // in particular, don't let Queue::reset() call
00243         // our deque() method
00244 }

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 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 CBQueue::sched  )  [inherited]
 

Definition at line 215 of file cbq.cc.

References Queue< T >::blocked_, Scheduler::instance(), CBQueue::intr_, Queue< T >::qh_, and Scheduler::schedule().

Referenced by CBQClass::recv().

00216 {
00217         Scheduler& s = Scheduler::instance();
00218         blocked_ = 1;
00219         s.schedule(&qh_, &intr_, 0);
00220 }

Here is the call graph for this function:

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:

int CBQueue::send_permitted CBQClass ,
double 
[protected, inherited]
 

Definition at line 390 of file cbq.cc.

References CBQClass::delayed_, CBQueue::find_lender(), CBQueue::last_lender_, CBQClass::permit_borrowing_, and CBQClass::undertime_.

Referenced by deque(), and CBQueue::deque().

00391 {
00392         if (cl->undertime_ < now) {
00393                 cl->delayed_ = 0;
00394                 last_lender_ = cl;
00395                 return (1);
00396         } else if (cl->permit_borrowing_ &&
00397                    (((cl = find_lender(cl, now)) != NULL))) {
00398                 last_lender_ = cl;
00399                 return (1);
00400         }
00401         return (0);
00402 }

Here is the call graph for this function:

void WRR_CBQueue::setM  )  [protected]
 

Definition at line 779 of file cbq.cc.

References abort(), alloc_, cnt_, M_, CBQueue::maxpkt_, and CBQueue::maxprio_.

Referenced by addallot(), and insert_class().

00780 {
00781         int i;
00782         for (i = 0; i <= maxprio_; i++) {
00783                 if (alloc_[i] > 0.0)
00784                         // allocate "cnt_[i] * maxpkt_" bytes to each
00785                         //  priority level:
00786                         M_[i] = cnt_[i] * maxpkt_ * 1.0 / alloc_[i];
00787                         // allocate "alloc_[i] * 2.0 * cnt_[i] * maxpkt_"
00788                         //  bytes to each priority level:
00789                         //  M_[i] = 2.0 * cnt_[i] * maxpkt_;
00790                 else
00791                         M_[i] = 0.0;
00792 
00793                 if (M_[i] < 0.0) {
00794                         fprintf(stderr, "M_[i]: %f, cnt_[i]: %d, maxpkt_: %d, alloc_[i]: %f\n",
00795                                 M_[i], cnt_[i], maxpkt_, alloc_[i]);
00796                         abort();
00797                 }
00798 
00799         }
00800         return;
00801 }

Here is the call graph for this function:

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(), RedPDQueue::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_; }

int CBQueue::toplevel  )  [inline, inherited]
 

Definition at line 149 of file cbq.cc.

References CBQueue::eligible_, and CBQueue::TOPLEVEL.

Referenced by deque(), CBQueue::deque(), CBQueue::find_lender(), and CBQClass::recv().

00149                                    {    // are we using toplevel?
00150 //              return (eligible_ == &eligible_toplevel);
00151                 return (eligible_ == TOPLEVEL);
00152         }

void CBQueue::toplevel_arrival CBQClass ,
double 
[inherited]
 

Definition at line 289 of file cbq.cc.

References CBQClass::lender_, CBQClass::permit_borrowing_, CBQueue::toplevel_, and CBQClass::undertime_.

Referenced by CBQClass::recv().

00290 {
00291         if (toplevel_ > 1) {
00292                 if (cl->undertime_ < now)
00293                         toplevel_ = 1;
00294                 else if (toplevel_ > 2 && cl->permit_borrowing_ && cl->lender_ != NULL) {
00295                         if (cl->lender_->undertime_ < now)
00296                                 toplevel_ = 2;
00297                 }
00298         }
00299 }

void CBQueue::toplevel_departure CBQClass ,
double 
[protected, inherited]
 

Definition at line 276 of file cbq.cc.

References CBQueue::last_lender_, CBQClass::level_, MAXLEVEL, QueueMonitor::pkts(), CBQClass::qmon_, CBQueue::toplevel_, and CBQClass::undertime_.

Referenced by deque(), and CBQueue::deque().

00277 {
00278         if (toplevel_ >= last_lender_->level_) {
00279                 if ((cl->qmon_->pkts() <= 1) ||
00280                     last_lender_->undertime_ > now) {
00281                         toplevel_ = MAXLEVEL;
00282                 } else {
00283                         toplevel_ = last_lender_->level_;
00284                 }
00285         }
00286 }

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; }

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

CBQClass* CBQueue::active_[MAXPRIO] [protected, inherited]
 

Definition at line 166 of file cbq.cc.

Referenced by CBQueue::CBQueue(), deque(), CBQueue::deque(), and CBQueue::insert_class().

double WRR_CBQueue::alloc_[MAXPRIO] [protected]
 

Definition at line 619 of file cbq.cc.

Referenced by addallot(), setM(), and WRR_CBQueue().

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().

int WRR_CBQueue::cnt_[MAXPRIO] [protected]
 

Definition at line 621 of file cbq.cc.

Referenced by insert_class(), setM(), and WRR_CBQueue().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

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

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

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

eligible_type_ CBQueue::eligible_ [protected, inherited]
 

Definition at line 176 of file cbq.cc.

Referenced by CBQueue::algorithm(), CBQueue::find_lender(), and CBQueue::toplevel().

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().

Event CBQueue::intr_ [protected, inherited]
 

Definition at line 155 of file cbq.cc.

Referenced by CBQueue::sched().

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().

CBQClass* CBQueue::last_lender_ [protected, inherited]
 

Definition at line 162 of file cbq.cc.

Referenced by CBQueue::send_permitted(), and CBQueue::toplevel_departure().

CBQClass* CBQueue::levels_[MAXLEVEL+1] [protected, inherited]
 

Definition at line 167 of file cbq.cc.

Referenced by CBQueue::CBQueue(), CBQueue::eligible_formal(), CBQueue::insert_class(), and CBQueue::level().

LinkDelay* CBQueue::link_ [protected, inherited]
 

Definition at line 164 of file cbq.cc.

Referenced by CBQueue::command(), CBQueue::insert_class(), and CBQueue::link().

double WRR_CBQueue::M_[MAXPRIO] [protected]
 

Definition at line 620 of file cbq.cc.

Referenced by deque(), setM(), and WRR_CBQueue().

int CBQueue::maxlevel_ [protected, inherited]
 

Definition at line 170 of file cbq.cc.

Referenced by CBQueue::insert_class().

int CBQueue::maxpkt_ [protected, inherited]
 

Definition at line 169 of file cbq.cc.

Referenced by CBQueue::CBQueue(), and setM().

int CBQueue::maxprio_ [protected, inherited]
 

Definition at line 168 of file cbq.cc.

Referenced by deque(), CBQueue::deque(), CBQueue::insert_class(), and setM().

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().

Packet* CBQueue::pending_pkt_ [protected, inherited]
 

Definition at line 163 of file cbq.cc.

Referenced by deque(), CBQueue::deque(), CBQueue::pending_pkt(), and CBQueue::recv().

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().

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().

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().

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().

int CBQueue::toplevel_ [protected, inherited]
 

Definition at line 171 of file cbq.cc.

Referenced by CBQueue::eligible_toplevel(), CBQueue::find_lender(), CBQueue::toplevel_arrival(), and CBQueue::toplevel_departure().

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().

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().

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 file:
Generated on Tue Apr 20 13:36:18 2004 for NS2.26SourcesOriginal by doxygen 1.3.3