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

SplayScheduler Class Reference

#include <scheduler.h>

Inheritance diagram for SplayScheduler:

Inheritance graph
[legend]
Collaboration diagram for SplayScheduler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SplayScheduler ()
void insert (Event *)
Eventdeque ()
const Eventhead ()
void cancel (Event *)
Eventlookup (scheduler_uid_t)
void schedule (Handler *, Event *, double delay)
virtual void run ()
double clock () const
virtual void sync ()
virtual double start ()
virtual void reset ()

Static Public Member Functions

Schedulerinstance ()

Protected Member Functions

Eventuid_lookup (Event *)
void dumpq ()
void dispatch (Event *)
void dispatch (Event *, double)
int command (int argc, const char *const *argv)

Protected Attributes

Eventroot_
scheduler_uid_t lookup_uid_
int qsize_
double clock_
int halted_

Static Protected Attributes

Schedulerinstance_
scheduler_uid_t uid_ = 1

Private Member Functions

int validate (Event *)

Constructor & Destructor Documentation

SplayScheduler::SplayScheduler  )  [inline]
 

Definition at line 185 of file scheduler.h.

References qsize_, and root_.

00185 : root_(0), qsize_(0) {}


Member Function Documentation

void SplayScheduler::cancel Event  )  [virtual]
 

Implements Scheduler.

Definition at line 255 of file splay-scheduler.cc.

References abort(), LEFT, qsize_, RIGHT, root_, Event::time_, and Event::uid_.

00256 {
00257 
00258         if (e->uid_ <= 0) 
00259                 return; // event not in queue
00260 
00261         Event **t;
00262         //validate();
00263         if (e == root_) {
00264                 t = &root_;
00265         } else {
00266                 // searching among same-time events is a real bugger,
00267                 // all because we don't have a parent pointer; use
00268                 // uid_ to resolve conflicts.
00269                 for (t = &root_; *t;) {
00270                         t = ((e->time_ > (*t)->time_) || 
00271                              ((e->time_ == (*t)->time_) && e->uid_ > (*t)->uid_))
00272                                 ? &RIGHT(*t) : &LEFT(*t);
00273                         if (*t == e)
00274                                 break;
00275                 }
00276                 if (*t == 0) {
00277                         fprintf(stderr, "did not find it\n");
00278                         abort(); // not found
00279                 }
00280         }
00281         // t is the pointer to e in the parent or to root_ if e is root_
00282         e->uid_ = -e->uid_;
00283         --qsize_;
00284 
00285         if (RIGHT(e) == 0) {
00286                 *t = LEFT(e);
00287                 LEFT(e) = 0;
00288                 //validate();
00289                 return;
00290         } 
00291         if (LEFT(e) == 0) {
00292                 *t = RIGHT(e);
00293                 RIGHT(e) = 0;
00294                 //validate();
00295                 return;
00296         }
00297 
00298         // find successor
00299         Event *p = RIGHT(e), *q = LEFT(p);
00300 
00301         if (q == 0) {
00302                 // p is the sucessor
00303                 *t = p;
00304                 LEFT(p) = LEFT(e);
00305                 //validate();
00306                 return;
00307         }
00308         for (; LEFT(q); p = q, q = LEFT(q)) 
00309                 ;
00310         // q is the successor
00311         // p is q's parent
00312         *t = q;
00313         LEFT(p) = RIGHT(q);
00314         LEFT(q) = LEFT(e);
00315         RIGHT(q) = RIGHT(e);
00316         RIGHT(e) = LEFT(e) = 0;
00317         //validate();
00318 }

Here is the call graph for this function:

double Scheduler::clock  )  const [inline, inherited]
 

Definition at line 90 of file scheduler.h.

References Scheduler::clock_.

Referenced by TcpSink::ack(), QSTcpSink::ack(), HttpMInvalCache::add_nbr(), Agent::addAgentTrace(), JoBS::adjustRatesRDC(), Trace::annotate(), SFDPolicy::applyMeter(), TRTCMPolicy::applyMeter(), SRTCMPolicy::applyMeter(), TBPolicy::applyMeter(), TSW3CMPolicy::applyMeter(), TSW2CMPolicy::applyMeter(), DumbPolicy::applyMeter(), EWPolicy::applyPolicer(), dsREDQueue::applyTSWMeter(), JoBS::arvAccounting(), JoBS::assignRateDropsADC(), MacCsma::backoff(), FlowTable::cleanup(), CorresHost::closecwnd(), Scheduler::command(), RedPDQueue::command(), PingAgent::command(), ProxyTracePagePool::command(), HttpYucInvalServer::command(), HttpApp::command(), redQueue::config(), PeriodicErrorModel::corrupt(), MultiStateErrorModel::corrupt(), TfrcAgent::decrease_rate(), REDQueue::deque(), JoBS::deque(), GK::deque(), Demarker::deque(), WRR_CBQueue::deque(), CBQueue::deque(), QA::DrainBuffers(), QueueMonitor::drop(), Scheduler::dumpq(), MacCsma::endofContention(), Vq::enque(), RIOQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), Marker::enque(), JoBS::enque(), GK::enque(), redQueue::enque(), ClientPagePool::enter_page(), MClientPagePool::enter_page(), TfrcSinkAgent::est_thput(), RateEstimator::estimateRate(), QueueMonitor::estimateRate(), REDQueue::estimator(), MacTimer::expire(), MacTdmaTimer::expire(), PromotionTimer::expire(), FlowMon::fformat(), Tagger::fformat(), Trace::format(), SatTrace::format(), CMUTrace::format_mac(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), PcapFileNetwork::gents(), PcapLiveNetwork::gents(), QA::get_data(), DSRAgent::getRouteForPacket(), GetTime(), TBF::getupdatedtokens(), PositionHandler::handle(), AdaptiveFidelityEntity::handle(), DSDVTriggerHandler::handle(), AckRecons::handle(), LmsReceiver::handle_lms_pkt(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), SRForwarder::handlePktWithoutSR(), DSDV_Agent::helper_callback(), QueueMonitorCompat::in(), QueueMonitor::in(), TfrcAgent::increase_rate(), PushbackAgent::initialUpdate(), Agent::initpkt(), redQueue::initREDStateVar(), SSMSRMAgent::is_active(), Mac802_11::is_idle(), WebTrafPool::launchReq(), EmpWebTrafSession::launchReq(), WebTrafPool::launchResp(), MobileNode::log_energy(), MobileNode::log_movement(), LoggingDataStruct::LoggingDataStruct(), IvsReceiver::lossMeter(), Internet::makeip(), LandmarkAgent::makeUpdate(), DSDV_Agent::makeUpdate(), AggSpec::member(), JoBS::minRatesNeeded(), Agent::monitorAgentTrace(), CMUTrace::nam_format(), DSDV_Agent::needTriggeredUpdate(), TcpAgent::newack(), TcpSessionAgent::newack(), SackRHTcpAgent::newack(), RFC793eduTcpAgent::newack(), FlowTable::noticeDeadLink(), FullTcpAgent::now(), BayFullTcpAgent::now(), TapAgent::now(), FtpSrvrAgent::now(), FtpClientAgent::now(), FackTcpAgent::oldack(), QueueMonitorCompat::out(), QueueMonitor::out(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), IntTcpAgent::output_helper(), TcpFsAgent::output_helper(), BackoffTimer::pause(), LandmarkAgent::periodic_callback(), JoBS::pickDroppedRLC(), Sack1TcpAgent::plot(), SackRHTcpAgent::plot(), FackTcpAgent::plot(), TfrcSinkAgent::print_loss(), TfrcSinkAgent::print_loss_all(), PushbackAgent::printMsg(), QueueMonitor::printRTTs(), QueueMonitor::printSeqnos(), QueueMonitor::printStats(), TcpAgent::process_qoption_after_send(), DSRAgent::processBrokenRouteError(), LandmarkAgent::ProcessHierUpdate(), LogWebTrafPool::processLog(), TCPTapAgent::processpkt(), TcpAgent::processQuickStart(), DSDV_Agent::processUpdate(), JoBS::projDelay(), PushbackAgent::pushbackCancel(), PushbackEvent::PushbackEvent(), PushbackAgent::pushbackRefresh(), QueueMonitor::QueueMonitor(), RTPAgent::rate_change(), RateEstimator::RateEstimator(), TokenBucketRateLimiter::rateLimit(), RateLimitSession::RateLimitSession(), RateLimitStrategy::RateLimitStrategy(), DequeTrace::recv(), TfrcAgent::recv(), TfrcSinkAgent::recv(), QSNewRenoTcpAgent::recv(), NewRenoTcpAgent::recv(), BayFullTcpAgent::recv(), TcpAsymSink::recv(), TBF::recv(), SRForwarder::recv(), SensorQueryAgent::recv(), SatDequeTrace::recv(), SALink::recv(), Queue< T >::recv(), PingAgent::recv(), IPNetwork::recv(), UDPIPNetwork::recv(), MIPMHAgent::recv(), LossMonitor::recv(), PLMLossMonitor::recv(), LmsReceiver::recv(), LmsAgent::recv(), IvsReceiver::recv(), FQ::recv(), FloodAgent::recv(), CBQClass::recv(), AdaptiveRcvr::recv(), AckRecons::recv(), SSMSRMAgent::recv_glb_sess(), HttpMInvalCache::recv_heartbeat(), TcpFsAgent::recv_helper(), SSMSRMAgent::recv_loc_sess(), TcpFsAgent::recv_newack_helper(), TcpAsymAgent::recv_newack_helper(), SSMSRMAgent::recv_rep_sess(), SRMAgent::recv_sess(), HttpMInvalCache::recv_upd(), toraAgent::recvCLR(), toraAgent::recvQRY(), toraAgent::recvUPD(), RateLimitSession::refreshed(), DSRAgent::replyFromRouteCache(), TcpAgent::reset(), TcpSink::reset(), REDQueue::reset(), TokenBucketRateLimiter::reset(), RateEstimator::reset(), TcpAgent::reset_qoption(), Queue< T >::resume(), BackoffTimer::resume(), DSRAgent::returnSrcRouteToRequestor(), TcpAgent::rtt_counting(), TcpAgent::rtt_update(), RFC793eduTcpAgent::rtt_update(), EWdetector::run(), TBrateLimitor::run(), Snoop::savepkt_(), SmacCounterTimer::sched(), SmacNeighNavTimer::sched(), SmacRecvTimer::sched(), SrmNode::sched_nack(), PushbackTimer::schedule(), TcpApp::send(), MacCsmaCa::send(), MacCsma::send(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), TcpAgent::send_much(), TcpSessionAgent::send_much(), LmsReceiver::send_nak(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), LmsSender::send_spm(), AckRecons::sendack(), DSRAgent::sendBufferCheck(), DiffusionAgent::SendBufferCheck(), LandmarkAgent::SendChangedTagListUpdate(), UdpAgent::sendmsg(), SimpleTcpAgent::sendmsg(), LmsSender::sendmsg(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), TfrcAgent::sendpkt(), TfrcSinkAgent::sendpkt(), SA_Agent::sendpkt(), RTPAgent::sendpkt(), IvsSource::sendpkt(), DSRAgent::sendRouteShortening(), Mac802_3::sendUp(), MobileNode::set_destination(), Mac802_11::set_nav(), EnergyModel::set_node_sleep(), EnergyModel::set_node_state(), TfrcAgent::slowstart(), Snoop::snoop_insert(), LLSnoop::snoop_rtt(), Snoop::snoop_rtt(), Snoop::snoop_rxmit(), RapAgent::start(), BackoffTimer::start(), DeferTimer::start(), MacTimer::start(), MacTdmaTimer::start(), LogWebTrafPool::start(), EnergyModel::start_powersaving(), DSDV_Agent::startUp(), OmniMcastAgent::StickPacketInSendBuffer(), DSRAgent::stickPacketInSendBuffer(), DiffusionAgent::StickPacketInSendBuffer(), RapAgent::stop(), TaggerTBFlow::tagging(), TaggerTSWFlow::tagging(), DSRAgent::tap(), TBrateLimitor::TBrateLimitor(), MIPMHAgent::timeout(), LmsReceiver::timeout(), SSMSRMAgent::timeout_info(), SmacNeighNavTimer::timeToExpire(), SmacRecvTimer::timeToExpire(), SmacCounterTimer::timeToSleep(), TokenBucketRateLimiter::TokenBucketRateLimiter(), TORANeighbor::TORANeighbor(), Vq::trace(), Trace::trace(), SALink::trace(), RIOQueue::trace(), REMQueue::trace(), REDQueue::trace(), PIQueue::trace(), Param_ADC::trace(), LDPAgent::trace(), GK::trace(), Estimator::trace(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), TransHistoryEntry::TransHistoryEntry(), MobileNode::update_position(), SMAC::updateNav(), SMAC::updateNeighNav(), ParentChildrenList::UpdatePotlChild(), ParentChildrenList::UpdatePotlParent(), redQueue::updateREDStateVar(), DSDV_Agent::updateRoute(), Queue< T >::updateStats(), JoBS::updateStats(), Queue< T >::utilization(), VegasTcpAgent::vegastime(), and DSRAgent::xmitFlowFailed().

00090                              {                  // simulator virtual time
00091                 return (clock_);
00092         }

int Scheduler::command int  argc,
const char *const *  argv
[protected, inherited]
 

Definition at line 188 of file scheduler.cc.

References at_handler, Scheduler::cancel(), Scheduler::clock(), MemTrace::diff(), Scheduler::dumpq(), Scheduler::halted_, Scheduler::instance_, Scheduler::lookup(), AtEvent::proc_, Scheduler::reset(), Scheduler::run(), Scheduler::schedule(), STRTOUID, Event::uid_, and UID_PRINTF_FORMAT.

00189 {
00190         Tcl& tcl = Tcl::instance();
00191         if (instance_ == 0)
00192                 instance_ = this;
00193         if (argc == 2) {
00194                 if (strcmp(argv[1], "run") == 0) {
00195                         /* set global to 0 before calling object reset methods */
00196                         reset();        // sets clock to zero
00197                         run();
00198                         return (TCL_OK);
00199                 } else if (strcmp(argv[1], "now") == 0) {
00200                         sprintf(tcl.buffer(), "%.17g", clock());
00201                         tcl.result(tcl.buffer());
00202                         return (TCL_OK);
00203                 } else if (strcmp(argv[1], "resume") == 0) {
00204                         halted_ = 0;
00205                         run();
00206                         return (TCL_OK);
00207                 } else if (strcmp(argv[1], "halt") == 0) {
00208                         halted_ = 1;
00209                         return (TCL_OK);
00210 
00211                 } else if (strcmp(argv[1], "clearMemTrace") == 0) {
00212 #ifdef MEMDEBUG_SIMULATIONS
00213                         extern MemTrace *globalMemTrace;
00214                         if (globalMemTrace)
00215                                 globalMemTrace->diff("Sim.");
00216 #endif
00217                         return (TCL_OK);
00218                 } else if (strcmp(argv[1], "is-running") == 0) {
00219                         sprintf(tcl.buffer(), "%d", !halted_);
00220                         return (TCL_OK);
00221                 } else if (strcmp(argv[1], "dumpq") == 0) {
00222                         if (!halted_) {
00223                                 fprintf(stderr, "Scheduler: dumpq only allowed while halted\n");
00224                                 tcl.result("0");
00225                                 return (TCL_ERROR);
00226                         }
00227                         dumpq();
00228                         return (TCL_OK);
00229                 }
00230         } else if (argc == 3) {
00231                 if (strcmp(argv[1], "at") == 0 ||
00232                     strcmp(argv[1], "cancel") == 0) {
00233                         Event* p = lookup(STRTOUID(argv[2]));
00234                         if (p != 0) {
00235                                 /*XXX make sure it really is an atevent*/
00236                                 cancel(p);
00237                                 AtEvent* ae = (AtEvent*)p;
00238                                 delete ae;
00239                         }
00240                 } else if (strcmp(argv[1], "at-now") == 0) {
00241                         const char* proc = argv[2];
00242 
00243                         // "at [$ns now]" may not work because of tcl's 
00244                         // string number resolution
00245                         AtEvent* e = new AtEvent;
00246                         int n = strlen(proc);
00247                         e->proc_ = new char[n + 1];
00248                         strcpy(e->proc_, proc);
00249                         schedule(&at_handler, e, 0);
00250                         sprintf(tcl.buffer(), UID_PRINTF_FORMAT, e->uid_);
00251                         tcl.result(tcl.buffer());
00252                 }
00253                 return (TCL_OK);
00254         } else if (argc == 4) {
00255                 if (strcmp(argv[1], "at") == 0) {
00256                         /* t < 0 means relative time: delay = -t */
00257                         double delay, t = atof(argv[2]);
00258                         const char* proc = argv[3];
00259 
00260                         AtEvent* e = new AtEvent;
00261                         int n = strlen(proc);
00262                         e->proc_ = new char[n + 1];
00263                         strcpy(e->proc_, proc);
00264                         delay = (t < 0) ? -t : t - clock();
00265                         if (delay < 0) {
00266                                 tcl.result("can't schedule command in past");
00267                                 return (TCL_ERROR);
00268                         }
00269                         schedule(&at_handler, e, delay);
00270                         sprintf(tcl.buffer(), UID_PRINTF_FORMAT, e->uid_);
00271                         tcl.result(tcl.buffer());
00272                         return (TCL_OK);
00273                 }
00274         }
00275         return (TclObject::command(argc, argv));
00276 }

Here is the call graph for this function:

Event * SplayScheduler::deque  )  [virtual]
 

Implements Scheduler.

Definition at line 209 of file splay-scheduler.cc.

References LEFT, ll, qsize_, RIGHT, and root_.

00210 {
00211         Event *t;
00212         Event *l;
00213         Event *ll;
00214         Event *lll;
00215 
00216         if (root_ == 0)
00217                 return 0;
00218 
00219         --qsize_;
00220 
00221         t = root_;
00222         l = LEFT(t);
00223 
00224         if (l == 0) {                   // root is the element to dequeue
00225                 root_ = RIGHT(t);       // right branch becomes the root
00226                 //validate();
00227                 return t;
00228         }
00229         for (;;) { 
00230                 ll = LEFT(l);
00231                 if (ll == 0) {
00232                         LEFT(t) = RIGHT(l);
00233                         //validate();
00234                         return l;
00235                 }
00236 
00237                 lll = LEFT(ll);
00238                 if (lll == 0) {
00239                         LEFT(l) = RIGHT(ll);
00240                         //validate();
00241                         return ll;
00242                 }
00243 
00244                 // zig-zig: rotate l with ll
00245                 LEFT(t) = ll;
00246                 LEFT(l) = RIGHT(ll);
00247                 RIGHT(ll) = l;
00248 
00249                 t = ll;
00250                 l = lll;
00251         }
00252 } 

void Scheduler::dispatch Event ,
double 
[protected, inherited]
 

Definition at line 140 of file scheduler.cc.

References abort(), Scheduler::clock_, Handler::handle(), Event::handler_, and Event::uid_.

00141 {
00142         if (t < clock_) {
00143                 fprintf(stderr, "ns: scheduler going backwards in time from %f to %f.\n", clock_, t);
00144                 abort();
00145         }
00146 
00147         clock_ = t;
00148         p->uid_ = -p->uid_;     // being dispatched
00149         p->handler_->handle(p); // dispatch
00150 }

Here is the call graph for this function:

void Scheduler::dispatch Event  )  [protected, inherited]
 

Definition at line 153 of file scheduler.cc.

References Event::time_.

Referenced by RealTimeScheduler::run(), and Scheduler::run().

00154 {
00155         dispatch(p, p->time_);
00156 }

void Scheduler::dumpq  )  [protected, inherited]
 

Definition at line 279 of file scheduler.cc.

References Scheduler::clock(), Scheduler::deque(), Event::handler_, Event::time_, Event::uid_, and UID_PRINTF_FORMAT.

Referenced by Scheduler::command().

00280 {
00281         Event *p;
00282 
00283         printf("Contents of scheduler queue (events) [cur time: %f]---\n",
00284                 clock());
00285         while ((p = deque()) != NULL) {
00286                 printf("t:%f uid: ", p->time_);
00287                 printf(UID_PRINTF_FORMAT, p->uid_);
00288                 printf(" handler: %p\n", p->handler_);
00289         }
00290 }

Here is the call graph for this function:

const Event * SplayScheduler::head  )  [virtual]
 

Implements Scheduler.

Definition at line 162 of file splay-scheduler.cc.

References LEFT, ll, RIGHT, and root_.

00163 {
00164         Event *t;
00165         Event *l;
00166 #if 1
00167         if (root_ == 0)
00168                 return 0;
00169         for (t = root_; (l = LEFT(t)); t = l)
00170                 ;
00171 
00172         return t;
00173 #else
00174         Event *ll;
00175         Event *lll;
00176 
00177         if (root_ == 0)
00178                 return 0;
00179 
00180         t = root_;
00181         l = LEFT(t);
00182 
00183         if (l == 0) {
00184                 return t;
00185         }
00186         for (;;) { 
00187                 ll = LEFT(l);
00188                 if (ll == 0) {
00189                         return l;
00190                 }
00191 
00192                 lll = LEFT(ll);
00193                 if (lll == 0) {
00194                         return ll;
00195                 }
00196 
00197                 // zig-zig: rotate l with ll
00198                 LEFT(t) = ll;
00199                 LEFT(l) = RIGHT(ll);
00200                 RIGHT(ll) = l;
00201 
00202                 t = ll;
00203                 l = lll;
00204         }
00205 #endif /* 1/0 */
00206 }

void SplayScheduler::insert Event  )  [virtual]
 

Implements Scheduler.

Definition at line 97 of file splay-scheduler.cc.

References LEFT, LINK_LEFT, LINK_RIGHT, qsize_, RIGHT, root_, ROTATE_LEFT, ROTATE_RIGHT, and Event::time_.

00098 {
00099         Event *l;       // bottom right in the left tree
00100         Event *r;       // bottom left in the right tree
00101         Event *t;       // root of the remaining tree
00102         Event *x;       // current node
00103     
00104         ++qsize_;
00105 
00106         double time = n->time_;
00107     
00108         if (root_ == 0) {
00109                 LEFT(n) = RIGHT(n) = 0;
00110                 root_ = n;
00111                 //validate();
00112                 return;
00113         }
00114         t = root_;
00115         root_ = n;      // n is the new root
00116         l = n;
00117         r = n;
00118         for (;;) {
00119                 if (time < t->time_) {
00120                         x = LEFT(t);
00121                         if (x == 0) {
00122                                 LEFT(r) = t;
00123                                 RIGHT(l) = 0;
00124                                 break;
00125                         }
00126                         if (time < x->time_) {
00127                                 ROTATE_RIGHT(t, x);
00128                         }
00129                         LINK_RIGHT(r, t);
00130                         if (t == 0) {
00131                                 RIGHT(l) = 0;
00132                                 break;
00133                         }
00134                 } else {
00135                         x = RIGHT(t);
00136                         if (x == 0) {
00137                                 RIGHT(l) = t; 
00138                                 LEFT(r) = 0;
00139                                 break;  
00140                         }
00141                         if (time >= x->time_) {
00142                                 ROTATE_LEFT(t, x);
00143                         }
00144                         LINK_LEFT(l, t);
00145                         if (t == 0) {
00146                                 LEFT(r) = 0;
00147                                 break;
00148                         }
00149                         
00150                 }
00151         } /* for (;;) */
00152 
00153         // assemble:
00154         //   swap left and right children
00155         x = LEFT(n);
00156         LEFT(n) = RIGHT(n);
00157         RIGHT(n) = x;
00158         //validate();
00159 }

Scheduler& Scheduler::instance  )  [inline, static, inherited]
 

Definition at line 80 of file scheduler.h.

Referenced by TimerHandler::_cancel(), TimerHandler::_sched(), DSRAgent::acceptRouteReply(), TcpSink::ack(), QSTcpSink::ack(), HttpMInvalCache::add_nbr(), Agent::addAgentTrace(), LandmarkAgent::AddMobileTag(), Cache::addRoute(), JoBS::adjustRatesRDC(), Trace::annotate(), Sacker::append_ack(), SFDPolicy::applyMeter(), TRTCMPolicy::applyMeter(), SRTCMPolicy::applyMeter(), TBPolicy::applyMeter(), TSW3CMPolicy::applyMeter(), TSW2CMPolicy::applyMeter(), DumbPolicy::applyMeter(), EWPolicy::applyPolicer(), dsREDQueue::applyTSWMeter(), ARPTable::arpinput(), ARPTable::arprequest(), JoBS::arvAccounting(), JoBS::assignRateDropsADC(), MacCsma::backoff(), MacHandlerRetx::cancel(), MacHandlerRecv::cancel(), Mac8023HandlerSend::cancel(), MacHandler::cancel(), imepTimer::cancel(), CorresHost::cancel(), SRM_Request::cancel_timer(), DSDV_Agent::cancelTriggersBefore(), HttpMInvalCache::check_sstate(), FlowTable::cleanup(), CorresHost::closecwnd(), RedPDQueue::command(), PingAgent::command(), ProxyTracePagePool::command(), CompMathPagePool::command(), MathPagePool::command(), TracePagePool::command(), MobiCache::command(), MediaApp::command(), LandmarkAgent::command(), HttpMInvalCache::command(), HttpYucInvalServer::command(), HttpApp::command(), DSRAgent::command(), DSDV_Agent::command(), redQueue::config(), PeriodicErrorModel::corrupt(), MultiStateErrorModel::corrupt(), QA::debug(), TfrcAgent::decrease_rate(), Agent::deleteAgentTrace(), REDQueue::deque(), JoBS::deque(), GK::deque(), DropTail::deque(), Demarker::deque(), WRR_CBQueue::deque(), CBQueue::deque(), TapAgent::dispatch(), EmpWebPage::doneObject(), QA::DrainBuffers(), QueueMonitor::drop(), DSRAgent::dropSendBuff(), MacTdma::dump(), Mac802_11::dump(), UnslottedAlohaMac::end_of_contention(), MacCsma::endofContention(), Vq::enque(), RIOQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), Marker::enque(), JoBS::enque(), GK::enque(), redQueue::enque(), ClientPagePool::enter_page(), MClientPagePool::enter_page(), TfrcSinkAgent::est_thput(), RateEstimator::estimateRate(), QueueMonitor::estimateRate(), REDQueue::estimator(), MacTimer::expire(), MacTdmaTimer::expire(), PromotionTimer::expire(), FlowMon::fformat(), Tagger::fformat(), RateLimitSessionList::filter(), SemanticPacketQueue::filterAcks(), MobiCache::findRoute(), Agent::flushAVar(), Trace::format(), SatTrace::format(), CMUTrace::format_mac(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), PcapFileNetwork::gents(), PcapLiveNetwork::gents(), QA::get_data(), DSRAgent::getRouteForPacket(), GetTime(), TBF::getupdatedtokens(), Snoop::handle(), PositionHandler::handle(), BackoffHandler::handle(), PollAckHandler::handle(), PollHandler::handle(), AdaptiveFidelityEntity::handle(), SoftNeighborHandler::handle(), DSDVTriggerHandler::handle(), RouteCacheTimer::handle(), NeighborTimer::handle(), HelloTimer::handle(), BroadcastTimer::handle(), AckRecons::handle(), LmsReceiver::handle_lms_pkt(), HttpMInvalCache::handle_node_failure(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), SRForwarder::handlePktWithoutSR(), DSRAgent::handlePktWithoutSR(), DSRAgent::handleRouteRequest(), DSDV_Agent::helper_callback(), QueueMonitorCompat::in(), QueueMonitor::in(), TfrcAgent::increase_rate(), PushbackAgent::initialUpdate(), Agent::initpkt(), redQueue::initREDStateVar(), MPLSAddressClassifier::install(), RapAgent::IpgTimeout(), SSMSRMAgent::is_active(), Mac802_11::is_idle(), WebTrafPool::launchReq(), EmpWebTrafSession::launchReq(), WebTrafPool::launchResp(), AODV::local_rt_repair(), MediaApp::log(), HttpApp::log(), MobileNode::log_energy(), MobileNode::log_movement(), CMUPriQueue::log_stats(), LoggingDataStruct::LoggingDataStruct(), RapAgent::LossHandler(), IvsReceiver::lossMeter(), DSDV_Agent::lost_link(), OmniMcastAgent::MACsend(), FloodingAgent::MACsend(), DiffusionAgent::MACsend(), Internet::makeip(), LandmarkAgent::makeUpdate(), DSDV_Agent::makeUpdate(), AggSpec::member(), JoBS::minRatesNeeded(), Agent::monitorAgentTrace(), LandmarkAgent::MoveTags(), CMUTrace::nam_format(), DSDV_Agent::needTriggeredUpdate(), GridKeeper::new_moves(), TcpAgent::newack(), TcpSessionAgent::newack(), SackRHTcpAgent::newack(), RFC793eduTcpAgent::newack(), Cache::noticeDeadLink(), MobiCache::noticeDeadLink(), FlowTable::noticeDeadLink(), FullTcpAgent::now(), BayFullTcpAgent::now(), TapAgent::now(), FtpSrvrAgent::now(), FtpClientAgent::now(), FackTcpAgent::oldack(), QueueMonitorCompat::out(), QueueMonitor::out(), TcpAgent::output(), VegasTcpAgent::output(), RFC793eduTcpAgent::output(), QSNewRenoTcpAgent::output(), IntTcpAgent::output(), IntTcpAgent::output_helper(), TcpFsAgent::output_helper(), DSDV_Agent::output_rte(), QA::panic(), BackoffTimer::pause(), LandmarkAgent::periodic_callback(), JoBS::pickDroppedRLC(), Cache::pickVictim(), Sack1TcpAgent::plot(), SackRHTcpAgent::plot(), FackTcpAgent::plot(), MultihopMac::poll(), TwoRayGround::Pr(), RouteCache::pre_addRoute(), TfrcSinkAgent::print_loss(), TfrcSinkAgent::print_loss_all(), PushbackAgent::printMsg(), QueueMonitor::printRTTs(), QueueMonitor::printSeqnos(), QueueMonitor::printStats(), TcpAgent::process_qoption_after_send(), DSRAgent::processBrokenRouteError(), LandmarkAgent::ProcessHierUpdate(), LogWebTrafPool::processLog(), TCPTapAgent::processpkt(), TcpAgent::processQuickStart(), DSRAgent::processUnknownFlowError(), DSDV_Agent::processUpdate(), JoBS::projDelay(), PushbackAgent::pushbackCancel(), PushbackEvent::PushbackEvent(), PushbackAgent::pushbackRefresh(), QueueMonitor::QueueMonitor(), RTPAgent::rate_change(), RateEstimator::RateEstimator(), TokenBucketRateLimiter::rateLimit(), RateLimitSession::RateLimitSession(), RateLimitStrategy::RateLimitStrategy(), DequeTrace::recv(), TfrcAgent::recv(), TfrcSinkAgent::recv(), TcpApp::recv(), QSNewRenoTcpAgent::recv(), NewRenoTcpAgent::recv(), BayFullTcpAgent::recv(), TcpAsymSink::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SRForwarder::recv(), LLSnoop::recv(), SessionHelper::recv(), SensorQueryAgent::recv(), SatDequeTrace::recv(), SALink::recv(), RapAgent::recv(), Queue< T >::recv(), PingResponder::recv(), PingAgent::recv(), IPNetwork::recv(), UDPIPNetwork::recv(), MIPMHAgent::recv(), MultihopMac::recv(), LossMonitor::recv(), PLMLossMonitor::recv(), LmsReceiver::recv(), LmsAgent::recv(), IvsReceiver::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), NoDupChannel::recv(), CBQClass::recv(), AdaptiveRcvr::recv(), AckRecons::recv(), SSMSRMAgent::recv_glb_sess(), HttpMInvalCache::recv_heartbeat(), TcpFsAgent::recv_helper(), HttpMInvalCache::recv_leave(), SSMSRMAgent::recv_loc_sess(), TcpFsAgent::recv_newack_helper(), TcpAsymAgent::recv_newack_helper(), SSMSRMAgent::recv_rep_sess(), SRMAgent::recv_sess(), HttpMInvalCache::recv_upd(), toraAgent::recvCLR(), TapAgent::recvpkt(), toraAgent::recvQRY(), toraAgent::recvUPD(), RateLimitSession::refreshed(), MClientPagePool::repl_atomic(), MClientPagePool::repl_finegrain(), DSRAgent::replyFromRouteCache(), TcpAgent::reset(), TcpSink::reset(), Snoop::reset(), RIOQueue::reset(), REDQueue::reset(), TokenBucketRateLimiter::reset(), RateEstimator::reset(), LinkDelay::reset(), TcpAgent::reset_qoption(), RateLimitStrategy::restrictPacketType(), Queue< T >::resume(), BackoffTimer::resume(), MacCsma::resume(), DSRAgent::returnSrcRouteToRequestor(), toraAgent::rt_resolve(), toraAgent::rtNotifyLinkUP(), TcpAgent::rtt_counting(), TcpAgent::rtt_update(), RFC793eduTcpAgent::rtt_update(), RapAgent::RttTimeout(), EWdetector::run(), TBrateLimitor::run(), Snoop::savepkt_(), SmacCounterTimer::sched(), SmacNeighNavTimer::sched(), SmacRecvTimer::sched(), CBQueue::sched(), SrmNode::sched_nack(), PushbackTimer::schedule(), MacHandlerIFS::schedule(), MacHandlerRetx::schedule(), MacHandlerRecv::schedule(), Mac8023HandlerSend::schedule(), TcpApp::send(), SrmNode::send(), MultihopMac::send(), MacCsmaCa::send(), MacCsma::send(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), TcpAgent::send_much(), TcpSessionAgent::send_much(), LmsReceiver::send_nak(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), LmsSender::send_spm(), AckRecons::sendack(), DSRAgent::sendBufferCheck(), DiffusionAgent::SendBufferCheck(), LandmarkAgent::SendChangedTagListUpdate(), SatMac::sendDown(), SatLL::sendDown(), Mac::sendDown(), LL::sendDown(), AODV::sendError(), EmpFtpTrafSession::sendFile(), AODV::sendHello(), UdpAgent::sendmsg(), SimpleTcpAgent::sendmsg(), LmsSender::sendmsg(), DSRAgent::sendOutBCastPkt(), DSDV_Agent::sendOutBCastPkt(), DSRAgent::sendOutPacketWithRoute(), DSRAgent::sendOutRtReq(), TfrcAgent::sendpkt(), TfrcSinkAgent::sendpkt(), SA_Agent::sendpkt(), RTPAgent::sendpkt(), IvsSource::sendpkt(), toraAgent::sendQRY(), AODV::sendReply(), AODV::sendRequest(), DSRAgent::sendRouteShortening(), DSRAgent::sendUnknownFlow(), WirelessPhy::sendUp(), SatMac::sendUp(), SatLL::sendUp(), Mac::sendUp(), Mac802_3::sendUp(), LL::sendUp(), Channel::sendUp(), MobileNode::set_destination(), Mac802_11::set_nav(), EnergyModel::set_node_sleep(), EnergyModel::set_node_state(), TBrateLimitor::setRate(), TfrcAgent::slowstart(), Snoop::snoop_cleanbufs_(), Snoop::snoop_data(), Snoop::snoop_insert(), LLSnoop::snoop_rtt(), Snoop::snoop_rtt(), Snoop::snoop_rxmit(), RapAgent::start(), MobileNode::start(), BackoffTimer::start(), DeferTimer::start(), MacTimer::start(), MacTdmaTimer::start(), LogWebTrafPool::start(), imepTimer::start(), AdaptiveFidelityEntity::start(), SoftNeighborHandler::start(), MobiHandler::start(), EnergyModel::start_powersaving(), LandmarkAgent::startUp(), DSDV_Agent::startUp(), OmniMcastAgent::StickPacketInSendBuffer(), DSRAgent::stickPacketInSendBuffer(), DiffusionAgent::StickPacketInSendBuffer(), SensorQueryAgent::stop(), RapAgent::stop(), MacTimer::stop(), MacTdmaTimer::stop(), LandmarkAgent::stop(), TaggerTBFlow::tagging(), TaggerTSWFlow::tagging(), DSRAgent::tap(), TBrateLimitor::TBrateLimitor(), PushbackQueue::timeout(), MIPMHAgent::timeout(), LmsReceiver::timeout(), SSMSRMAgent::timeout_info(), SmacNeighNavTimer::timeToExpire(), SmacRecvTimer::timeToExpire(), SmacCounterTimer::timeToSleep(), TokenBucketRateLimiter::TokenBucketRateLimiter(), TORANeighbor::TORANeighbor(), Vq::trace(), Trace::trace(), SALink::trace(), RIOQueue::trace(), REMQueue::trace(), REDQueue::trace(), PIQueue::trace(), Param_ADC::trace(), LDPAgent::trace(), GK::trace(), Estimator::trace(), MPLSAddressClassifier::trace(), Agent::trace(), TcpAgent::trace_event(), TcpAgent::traceAll(), TcpAsymAgent::traceAll(), TcpAgent::traceVar(), TcpSessionAgent::traceVar(), TcpAsymAgent::traceVar(), TransHistoryEntry::TransHistoryEntry(), DSRAgent::undeliverablePkt(), Acker::update(), MobileNode::update_position(), SMAC::updateNav(), SMAC::updateNeighNav(), ParentChildrenList::UpdatePotlChild(), ParentChildrenList::UpdatePotlParent(), redQueue::updateREDStateVar(), DSDV_Agent::updateRoute(), QA::UpdateState(), Queue< T >::updateStats(), JoBS::updateStats(), Queue< T >::utilization(), PingResponder::validate(), VegasTcpAgent::vegastime(), DSRAgent::xmitFailed(), DSRAgent::xmitFlowFailed(), and ParentChildrenList::~ParentChildrenList().

00080                                      {
00081                 return (*instance_);            // general access to scheduler
00082         }

Event * SplayScheduler::lookup scheduler_uid_t   )  [virtual]
 

Implements Scheduler.

Definition at line 322 of file splay-scheduler.cc.

References lookup_uid_, root_, and uid_lookup().

00323 {
00324         lookup_uid_ = uid;
00325         return uid_lookup(root_);
00326 }

Here is the call graph for this function:

void Scheduler::reset  )  [virtual, inherited]
 

Reimplemented in RealTimeScheduler.

Definition at line 182 of file scheduler.cc.

References Scheduler::clock_, and SCHED_START.

Referenced by Scheduler::command().

00183 {
00184         clock_ = SCHED_START;
00185 }

void Scheduler::run  )  [virtual, inherited]
 

Reimplemented in RealTimeScheduler.

Definition at line 118 of file scheduler.cc.

References Scheduler::deque(), Scheduler::dispatch(), Scheduler::halted_, and Scheduler::instance_.

Referenced by Scheduler::command().

00119 {
00120         instance_ = this;
00121         Event *p;
00122         /*
00123          * The order is significant: if halted_ is checked later,
00124          * event p could be lost when the simulator resumes.
00125          * Patch by Thomas Kaemer <Thomas.Kaemer@eas.iis.fhg.de>.
00126          */
00127         while (!halted_ && (p = deque())) {
00128                 dispatch(p, p->time_);
00129         }
00130 }

Here is the call graph for this function:

void Scheduler::schedule Handler ,
Event ,
double  delay
[inherited]
 

Definition at line 83 of file scheduler.cc.

References abort(), Scheduler::clock_, Event::handler_, Scheduler::insert(), Event::time_, Scheduler::uid_, and Event::uid_.

Referenced by TimerHandler::_sched(), LandmarkAgent::AddMobileTag(), ARPTable::arpinput(), ARPTable::arprequest(), MacCsma::backoff(), Scheduler::command(), LandmarkAgent::command(), UnslottedAlohaMac::end_of_contention(), MacCsma::endofContention(), PromotionTimer::expire(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), SensorQueryAgent::generate_query(), Snoop::handle(), PositionHandler::handle(), BackoffHandler::handle(), PollHandler::handle(), AdaptiveFidelityEntity::handle(), SoftNeighborHandler::handle(), DSDVTriggerHandler::handle(), RouteCacheTimer::handle(), NeighborTimer::handle(), HelloTimer::handle(), BroadcastTimer::handle(), DSRAgent::handleFlowForwarding(), DSDV_Agent::helper_callback(), AODV::local_rt_repair(), OmniMcastAgent::MACsend(), FloodingAgent::MACsend(), DiffusionAgent::MACsend(), LandmarkAgent::MoveTags(), DSDV_Agent::needTriggeredUpdate(), GridKeeper::new_moves(), LandmarkAgent::periodic_callback(), MultihopMac::poll(), LandmarkAgent::ProcessHierUpdate(), DSDV_Agent::processUpdate(), LLSnoop::recv(), SessionHelper::recv(), MultihopMac::recv(), FloodAgent::recv(), ErrorModel::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), NoDupChannel::recv(), TapAgent::recvpkt(), BackoffTimer::resume(), MacCsma::resume(), DSRAgent::returnSrcRouteToRequestor(), CBQueue::sched(), SrmNode::sched_nack(), MacHandlerIFS::schedule(), MacHandlerRetx::schedule(), MacHandlerRecv::schedule(), Mac8023HandlerSend::schedule(), SrmNode::send(), MultihopMac::send(), MacCsma::send(), AckRecons::sendack(), LandmarkAgent::SendChangedTagListUpdate(), SatMac::sendDown(), SatLL::sendDown(), Mac::sendDown(), LL::sendDown(), AODV::sendError(), AODV::sendHello(), DSRAgent::sendOutBCastPkt(), DSDV_Agent::sendOutBCastPkt(), DSRAgent::sendOutPacketWithRoute(), AODV::sendReply(), AODV::sendRequest(), SatMac::sendUp(), SatLL::sendUp(), Mac::sendUp(), LL::sendUp(), Channel::sendUp(), Snoop::snoop_cleanbufs_(), Snoop::snoop_data(), Snoop::snoop_rxmit(), MobileNode::start(), BackoffTimer::start(), DeferTimer::start(), MacTimer::start(), MacTdmaTimer::start(), imepTimer::start(), AdaptiveFidelityEntity::start(), SoftNeighborHandler::start(), MobiHandler::start(), LandmarkAgent::startUp(), and DSDV_Agent::startUp().

00084 {
00085         // handler should ALWAYS be set... if it's not, it's a bug in the caller
00086         if (!h) {
00087                 fprintf(stderr,
00088                         "Scheduler: attempt to schedule an event with a NULL handler."
00089                         "  Don't DO that.\n");
00090                 abort();
00091         };
00092         if (e->uid_ > 0) {
00093                 printf("Scheduler: Event UID not valid!\n\n");
00094                 abort();
00095         }
00096         
00097         if (delay < 0) {
00098                 // You probably don't want to do this
00099                 // (it probably represents a bug in your simulation).
00100                 fprintf(stderr, 
00101                         "warning: ns Scheduler::schedule: scheduling event\n\t"
00102                         "with negative delay (%f) at time %f.\n", delay, clock_);
00103         }
00104 
00105         if (uid_ < 0) {
00106                 fprintf(stderr, "Scheduler: UID space exhausted!\n");
00107                 abort();
00108         }
00109         e->uid_ = uid_++;
00110         e->handler_ = h;
00111         double t = clock_ + delay;
00112 
00113         e->time_ = t;
00114         insert(e);
00115 }

Here is the call graph for this function:

virtual double Scheduler::start void   )  [inline, virtual, inherited]
 

Definition at line 94 of file scheduler.h.

References SCHED_START.

00094                                {                // start time
00095                 return SCHED_START;
00096         }

virtual void Scheduler::sync  )  [inline, virtual, inherited]
 

Reimplemented in RealTimeScheduler.

Definition at line 93 of file scheduler.h.

Referenced by TapAgent::dispatch().

00093 {};

Event * SplayScheduler::uid_lookup Event  )  [protected]
 

Definition at line 329 of file splay-scheduler.cc.

References LEFT, lookup_uid_, RIGHT, and Event::uid_.

Referenced by lookup().

00330 {
00331         if (root == 0)
00332                 return 0;
00333         if (root->uid_ == lookup_uid_)
00334                 return root;
00335 
00336         Event *res = uid_lookup(LEFT(root));
00337  
00338         if (res) 
00339                 return res;
00340 
00341         return uid_lookup(RIGHT(root));
00342 }

int SplayScheduler::validate Event  )  [private]
 

Definition at line 345 of file splay-scheduler.cc.

References LEFT, RIGHT, and Event::time_.

00346 {
00347         int size = 0;
00348         if (root) {
00349                 ++size;
00350                 assert(LEFT(root) == 0 || root->time_ >= LEFT(root)->time_);
00351                 assert(RIGHT(root) == 0 || root->time_ <= RIGHT(root)->time_);
00352                 size += validate(LEFT(root));
00353                 size += validate(RIGHT(root));
00354                 return size;
00355         }
00356         return 0;
00357 }


Member Data Documentation

double Scheduler::clock_ [protected, inherited]
 

Definition at line 105 of file scheduler.h.

Referenced by Scheduler::clock(), Scheduler::dispatch(), RealTimeScheduler::reset(), Scheduler::reset(), RealTimeScheduler::run(), Scheduler::schedule(), and RealTimeScheduler::sync().

int Scheduler::halted_ [protected, inherited]
 

Definition at line 106 of file scheduler.h.

Referenced by Scheduler::command(), RealTimeScheduler::run(), and Scheduler::run().

Scheduler * Scheduler::instance_ [static, protected, inherited]
 

Definition at line 55 of file scheduler.cc.

Referenced by Scheduler::command(), RealTimeScheduler::run(), Scheduler::run(), and Scheduler::~Scheduler().

scheduler_uid_t SplayScheduler::lookup_uid_ [protected]
 

Definition at line 203 of file scheduler.h.

Referenced by lookup(), and uid_lookup().

int SplayScheduler::qsize_ [protected]
 

Definition at line 204 of file scheduler.h.

Referenced by cancel(), deque(), insert(), and SplayScheduler().

Event* SplayScheduler::root_ [protected]
 

Definition at line 202 of file scheduler.h.

Referenced by cancel(), deque(), head(), insert(), lookup(), and SplayScheduler().

scheduler_uid_t Scheduler::uid_ = 1 [static, protected, inherited]
 

Definition at line 56 of file scheduler.cc.

Referenced by Scheduler::schedule().


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