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

Null_Est Class Reference

Inheritance diagram for Null_Est:

Inheritance graph
[legend]
Collaboration diagram for Null_Est:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Null_Est ()
double avload ()
virtual void change_avload (double incr)
virtual void newflow (double)
int command (int argc, const char *const *argv)
virtual void timeout (int)
void recv (Packet *, Handler *)
virtual void recv (Packet *p, const char *s)
virtual void start ()
void stop ()
void setmeasmod (MeasureMod *)
void setactype (const char *)
double & period ()
void trace (TracedVar *v)
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 Member Functions

void estimate ()
virtual void reset ()
void handle (Event *)

Protected Attributes

MeasureModmeas_mod_
TracedDouble avload_
double period_
Estimator_Timer est_timer_
TracedDouble measload_
Tcl_Channel tchan_
int src_
int dst_
double omeasload_
double oavload_
char * actype_
int debug_

Constructor & Destructor Documentation

Null_Est::Null_Est  ) 
 

Definition at line 38 of file null-estimator.cc.

00039 {
00040 
00041 }


Member Function Documentation

double Estimator::avload  )  [inline, inherited]
 

Definition at line 45 of file estimator.h.

References Estimator::avload_.

Referenced by MS_ADC::admit_flow(), HB_ADC::admit_flow(), ACTP_ADC::admit_flow(), and ACTO_ADC::admit_flow().

00045 { return double(avload_);};

virtual void Estimator::change_avload double  incr  )  [inline, virtual, inherited]
 

Reimplemented in TimeWindow_Est.

Definition at line 47 of file estimator.h.

References Estimator::avload_.

Referenced by MS_ADC::admit_flow(), HB_ADC::admit_flow(), ACTP_ADC::admit_flow(), ACTO_ADC::admit_flow(), and MS_ADC::rej_action().

00047 { avload_ += incr;}

int Estimator::command int  argc,
const char *const *  argv
[virtual, inherited]
 

Reimplemented from NsObject.

Definition at line 39 of file estimator.cc.

References Estimator::avload_, MeasureMod::bitcnt(), NsObject::command(), Estimator::meas_mod_, Estimator::period_, and Estimator::tchan_.

00040 {
00041         Tcl& tcl = Tcl::instance();
00042         if (argc==2) {
00043                 if (strcmp(argv[1],"load-est") == 0) {
00044                         tcl.resultf("%.3f",double(avload_));
00045                         return(TCL_OK);
00046                 } else if (strcmp(argv[1],"link-utlzn") == 0) {
00047                         tcl.resultf("%.3f",meas_mod_->bitcnt()/period_);
00048                         return(TCL_OK);
00049                 }
00050         }
00051         if (argc == 3) {
00052                 if (strcmp(argv[1], "attach") == 0) {
00053                         int mode;
00054                         const char* id = argv[2];
00055                         tchan_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00056                         if (tchan_ == 0) {
00057                                 tcl.resultf("Estimator: trace: can't attach %s for writing", id);
00058                                 return (TCL_ERROR);
00059                         }
00060                         return (TCL_OK);
00061                 }
00062                 if (strcmp(argv[1], "setbuf") == 0) {
00063                         /* some sub classes actually do something here */
00064                         return(TCL_OK);
00065                 }
00066         }
00067         return NsObject::command(argc,argv);
00068 }

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 }

void Null_Est::estimate  )  [protected, virtual]
 

Implements Estimator.

Definition at line 43 of file null-estimator.cc.

References MeasureMod::bitcnt(), Estimator::meas_mod_, Estimator::measload_, Estimator::period_, and MeasureMod::resetbitcnt().

00043                         {
00044 
00045         measload_ = meas_mod_->bitcnt()/period_;
00046         meas_mod_->resetbitcnt();
00047 
00048 }

Here is the call graph for this function:

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 NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

virtual void Estimator::newflow double   )  [inline, virtual, inherited]
 

Definition at line 48 of file estimator.h.

00048 {};

double& Estimator::period  )  [inline, inherited]
 

Definition at line 56 of file estimator.h.

References Estimator::period_.

Referenced by ADC::peak_rate().

00056 { return period_;}

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 Estimator::recv Packet ,
Handler
[inline, virtual, inherited]
 

Implements NsObject.

Definition at line 51 of file estimator.h.

00051 {}

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 NsObject::reset  )  [protected, virtual, inherited]
 

Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void Estimator::setactype const char *   )  [inherited]
 

Definition at line 138 of file estimator.cc.

References Estimator::actype_.

Referenced by ADC::setest().

00139 {
00140         actype_ = new char[strlen(type)+1];
00141         strcpy(actype_, type);
00142         return;
00143 }

void Estimator::setmeasmod MeasureMod  )  [inherited]
 

Definition at line 70 of file estimator.cc.

References Estimator::meas_mod_.

Referenced by ADC::command().

00071 {
00072         meas_mod_=measmod;
00073 }

void Estimator::start  )  [virtual, inherited]
 

Definition at line 75 of file estimator.cc.

References Estimator::avload_, Estimator::est_timer_, Estimator::measload_, Estimator::period_, and TimerHandler::resched().

Referenced by ADC::command().

00076 {
00077         avload_=0;
00078         measload_ = 0;
00079         est_timer_.resched(period_);
00080 }

Here is the call graph for this function:

void Estimator::stop  )  [inherited]
 

Definition at line 82 of file estimator.cc.

References TimerHandler::cancel(), and Estimator::est_timer_.

00083 {
00084         est_timer_.cancel();
00085 }

Here is the call graph for this function:

void Estimator::timeout int   )  [virtual, inherited]
 

Definition at line 87 of file estimator.cc.

References Estimator::est_timer_, Estimator::estimate(), Estimator::period_, and TimerHandler::resched().

Referenced by Estimator_Timer::expire().

00088 {
00089         estimate();
00090         est_timer_.resched(period_);
00091 }

Here is the call graph for this function:

void Estimator::trace TracedVar *  v  )  [inherited]
 

Definition at line 98 of file estimator.cc.

References Estimator::actype_, Scheduler::clock(), Estimator::dst_, Scheduler::instance(), Estimator::oavload_, Estimator::omeasload_, Estimator::src_, and Estimator::tchan_.

00099 {
00100         char wrk[500];
00101         double *p, newval;
00102 
00103         /* check for right variable */
00104         if (strcmp(v->name(), "\"Estimated Util.\"") == 0) {
00105                 p = &oavload_;
00106         }
00107         else if (strcmp(v->name(), "\"Measured Util.\"") == 0) {
00108                 p = &omeasload_;
00109         }
00110         else {
00111                 fprintf(stderr, "Estimator: unknown trace var %s\n", v->name());
00112                 return;
00113         }
00114 
00115         newval = double(*((TracedDouble*)v));
00116 
00117         if (tchan_) {
00118                 int n;
00119                 double t = Scheduler::instance().clock();
00120                 /* f -t 0.0 -s 1 -a SA -T v -n Num -v 0 -o 0 */
00121                 sprintf(wrk, "f -t %g -s %d -a %s:%d-%d -T v -n %s -v %g -o %g",
00122                         t, src_, actype_, src_, dst_, v->name(), newval, *p);
00123                 n = strlen(wrk);
00124                 wrk[n] = '\n';
00125                 wrk[n+1] = 0;
00126                 (void)Tcl_Write(tchan_, wrk, n+1);
00127                 
00128         }
00129 
00130         *p = newval;
00131 
00132         return;
00133 
00134 
00135 
00136 }

Here is the call graph for this function:


Member Data Documentation

char* Estimator::actype_ [protected, inherited]
 

Definition at line 70 of file estimator.h.

Referenced by Estimator::setactype(), and Estimator::trace().

TracedDouble Estimator::avload_ [protected, inherited]
 

Definition at line 60 of file estimator.h.

Referenced by Estimator::avload(), TimeWindow_Est::change_avload(), Estimator::change_avload(), Estimator::command(), TimeWindow_Est::estimate(), PointSample_Est::estimate(), ExpAvg_Est::estimate(), Estimator::Estimator(), and Estimator::start().

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

int Estimator::dst_ [protected, inherited]
 

Definition at line 67 of file estimator.h.

Referenced by Estimator::Estimator(), and Estimator::trace().

Estimator_Timer Estimator::est_timer_ [protected, inherited]
 

Definition at line 63 of file estimator.h.

Referenced by Estimator::start(), Estimator::stop(), and Estimator::timeout().

MeasureMod* Estimator::meas_mod_ [protected, inherited]
 

Definition at line 59 of file estimator.h.

Referenced by Estimator::command(), TimeWindow_Est::estimate(), PointSample_Est::estimate(), estimate(), ExpAvg_Est::estimate(), and Estimator::setmeasmod().

TracedDouble Estimator::measload_ [protected, inherited]
 

Definition at line 64 of file estimator.h.

Referenced by TimeWindow_Est::estimate(), estimate(), Estimator::Estimator(), and Estimator::start().

double Estimator::oavload_ [protected, inherited]
 

Definition at line 69 of file estimator.h.

Referenced by Estimator::trace().

double Estimator::omeasload_ [protected, inherited]
 

Definition at line 68 of file estimator.h.

Referenced by Estimator::trace().

double Estimator::period_ [protected, inherited]
 

Definition at line 61 of file estimator.h.

Referenced by Estimator::command(), TimeWindow_Est::estimate(), PointSample_Est::estimate(), estimate(), ExpAvg_Est::estimate(), Estimator::Estimator(), Estimator::period(), Estimator::start(), and Estimator::timeout().

int Estimator::src_ [protected, inherited]
 

Definition at line 66 of file estimator.h.

Referenced by Estimator::Estimator(), and Estimator::trace().

Tcl_Channel Estimator::tchan_ [protected, inherited]
 

Definition at line 65 of file estimator.h.

Referenced by Estimator::command(), and Estimator::trace().


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