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

TaggerTSWFlow Class Reference

#include <flowmon.h>

Inheritance diagram for TaggerTSWFlow:

Inheritance graph
[legend]
Collaboration diagram for TaggerTSWFlow:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TaggerTSWFlow ()
void tagging (Packet *)
void run_rate_estimator (Packet *p, double now)
nsaddr_t src () const
nsaddr_t dst () const
int flowid () const
packet_t ptype () const
void setfields (Packet *p)
void edrop (Packet *p)
void mon_edrop (Packet *p)
int epdrops () const
int ebdrops () const
int mon_epdrops () const
int mon_ebdrops () const
int size () const
int pkts () const
int parrivals () const
int barrivals () const
int pdepartures () const
int bdepartures () const
int pdrops () const
int pmarks () const
int bdrops () const
void printRTTs ()
void printSeqnos ()
void printStats ()
virtual void in (Packet *)
virtual void out (Packet *)
virtual void drop (Packet *)
virtual int command (int argc, const char *const *argv)

Public Attributes

int estimate_rate_
double k_
double estRate_
double prevTime_
double startTime_

Protected Member Functions

void estimateRate (Packet *p)
void keepRTTstats (Packet *p)
void keepSeqnoStats (Packet *p)

Protected Attributes

double target_rate_
double win_len_
double avg_rate_
double t_front_
int count
int wait_
double total_in
double total_out
nsaddr_t src_
nsaddr_t dst_
int fid_
packet_t type_
int ebdrops_
int epdrops_
int mon_ebdrops_
int mon_epdrops_
IntegratorbytesInt_
IntegratorpktsInt_
SamplesdelaySamp_
int size_
int pkts_
int parrivals_
int barrivals_
int pdepartures_
int bdepartures_
int pdrops_
int pmarks_
int bdrops_
int keepRTTstats_
int maxRTT_
int numRTTs_
int binsPerSec_
int * RTTbins_
int keepSeqnoStats_
int maxSeqno_
int numSeqnos_
int SeqnoBinSize_
int * SeqnoBins_
int srcId_
int dstId_
Tcl_Channel channel_
Tcl_Channel channel1_
int temp_size_

Constructor & Destructor Documentation

TaggerTSWFlow::TaggerTSWFlow  )  [inline]
 

Definition at line 133 of file flowmon.h.

References avg_rate_, t_front_, target_rate_, total_in, total_out, wait_, and win_len_.

00133                         : target_rate_(0.0), avg_rate_(0.0), 
00134                         t_front_(0.0), total_in(0.0), total_out(0.0) 
00135         {
00136                 bind_bw("target_rate_", &target_rate_);
00137                 bind("win_len_", &win_len_);
00138                 bind_bool("wait_", &wait_);
00139                 //              bind("off_flags_", &off_flags_);
00140         }


Member Function Documentation

int QueueMonitor::barrivals  )  const [inline, inherited]
 

Definition at line 101 of file queue-monitor.h.

References QueueMonitor::barrivals_.

Referenced by FlowMon::fformat(), Tagger::fformat(), and PushbackQueue::timeout().

00101 { return (barrivals_); }

int QueueMonitor::bdepartures  )  const [inline, inherited]
 

Definition at line 103 of file queue-monitor.h.

References QueueMonitor::bdepartures_.

Referenced by PushbackQueue::timeout().

00103 { return (bdepartures_); }

int QueueMonitor::bdrops  )  const [inline, inherited]
 

Definition at line 107 of file queue-monitor.h.

References QueueMonitor::bdrops_.

Referenced by FlowMon::fformat(), Tagger::fformat(), and PushbackQueue::timeout().

00107 { return (bdrops_); }

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

Reimplemented in Tagger, FlowMon, and QueueMonitorCompat.

Definition at line 44 of file queue-monitor.cc.

References QueueMonitor::bytesInt_, QueueMonitor::channel1_, QueueMonitor::channel_, QueueMonitor::delaySamp_, QueueMonitor::dstId_, QueueMonitor::keepRTTstats_, QueueMonitor::keepSeqnoStats_, QueueMonitor::pktsInt_, QueueMonitor::printRTTs(), QueueMonitor::printSeqnos(), and QueueMonitor::srcId_.

Referenced by QueueMonitorCompat::command(), FlowMon::command(), and Tagger::command().

00045 {
00046         Tcl& tcl = Tcl::instance();
00047 
00048         if (argc == 2) {
00049                 if (strcmp(argv[1], "get-bytes-integrator") == 0) {
00050                         if (bytesInt_)
00051                                 tcl.resultf("%s", bytesInt_->name());
00052                         else
00053                                 tcl.resultf("");
00054                         return (TCL_OK);
00055                 }
00056                 if (strcmp(argv[1], "get-pkts-integrator") == 0) {
00057                         if (pktsInt_)
00058                                 tcl.resultf("%s", pktsInt_->name());
00059                         else
00060                                 tcl.resultf("");
00061                         return (TCL_OK);
00062                 }
00063                 if (strcmp(argv[1], "get-delay-samples") == 0) {
00064                         if (delaySamp_)
00065                                 tcl.resultf("%s", delaySamp_->name());
00066                         else
00067                                 tcl.resultf("");
00068                         return (TCL_OK);
00069                 }
00070                 if (strcmp(argv[1], "printRTTs") == 0) {
00071                         if (keepRTTstats_ && channel1_) {
00072                                 printRTTs();
00073                         } 
00074                         return (TCL_OK);
00075                 }
00076                 if (strcmp(argv[1], "printSeqnos") == 0) {
00077                         if (keepSeqnoStats_ && channel1_) {
00078                                 printSeqnos();
00079                         } 
00080                         return (TCL_OK);
00081                 }
00082         }
00083 
00084         if (argc == 3) {
00085                 if (strcmp(argv[1], "set-bytes-integrator") == 0) {
00086                         bytesInt_ = (Integrator *)
00087                                 TclObject::lookup(argv[2]);
00088                         if (bytesInt_ == NULL)
00089                                 return (TCL_ERROR);
00090                         return (TCL_OK);
00091                 }
00092                 if (strcmp(argv[1], "set-pkts-integrator") == 0) {
00093                         pktsInt_ = (Integrator *)
00094                                 TclObject::lookup(argv[2]);
00095                         if (pktsInt_ == NULL)
00096                                 return (TCL_ERROR);
00097                         return (TCL_OK);
00098                 }
00099                 if (strcmp(argv[1], "set-delay-samples") == 0) {
00100                         delaySamp_ = (Samples*)
00101                                 TclObject::lookup(argv[2]);
00102                         if (delaySamp_ == NULL)
00103                                 return (TCL_ERROR);
00104                         return (TCL_OK);
00105                 }
00106                 if (strcmp(argv[1], "trace") == 0) {
00107                         // for printStats
00108                         int mode;
00109                         const char* id = argv[2];
00110                         channel_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00111                                                 if (channel_ == 0) {
00112                                 tcl.resultf("trace: can't attach %s for writing", id);
00113                                 return (TCL_ERROR);
00114                         }
00115                         return (TCL_OK);
00116                 }
00117                 if (strcmp(argv[1], "traceDist") == 0) {
00118                         // for printRTTs and printSeqnos distributions
00119                         int mode;
00120                         const char* id = argv[2];
00121                         channel1_ = Tcl_GetChannel(tcl.interp(), (char*)id, &mode);
00122                                                 if (channel1_ == 0) {
00123                                 tcl.resultf("trace: can't attach %s for writing", id);
00124                                 return (TCL_ERROR);
00125                         }
00126                         return (TCL_OK);
00127                 }
00128         }
00129         if (argc == 4) {
00130                 if (strcmp(argv[1], "set-src-dst") == 0) {
00131                         srcId_ = atoi(argv[2]);
00132                         dstId_ = atoi(argv[3]);
00133                         return (TCL_OK);
00134                 }
00135         }
00136         return TclObject::command(argc, argv);  // else control reaches end of
00137                                                 // non-void function, see? :-)
00138 }

Here is the call graph for this function:

void QueueMonitor::drop Packet  )  [virtual, inherited]
 

Reimplemented in FlowMon, and QueueMonitorCompat.

Definition at line 282 of file queue-monitor.cc.

References hdr_cmn::access(), QueueMonitor::bdrops_, QueueMonitor::bytesInt_, QueueMonitor::channel_, Scheduler::clock(), Scheduler::instance(), Integrator::newPoint(), QueueMonitor::pdrops_, QueueMonitor::pkts_, QueueMonitor::pktsInt_, QueueMonitor::printStats(), hdr_cmn::size(), and QueueMonitor::size_.

Referenced by QueueMonitorCompat::drop(), FlowMon::drop(), EDQueueMonitor::edrop(), EDQueueMonitor::mon_edrop(), and SnoopQueueDrop::recv().

00283 {
00284         hdr_cmn* hdr = hdr_cmn::access(p);
00285         double now = Scheduler::instance().clock();
00286         int pktsz = hdr->size();
00287 
00288         size_ -= pktsz;
00289         pkts_--;
00290         bdrops_ += pktsz;
00291         pdrops_++;
00292         if (bytesInt_)
00293                 bytesInt_->newPoint(now, double(size_));
00294         if (pktsInt_)
00295                 pktsInt_->newPoint(now, double(pkts_));
00296         if (channel_)
00297                 printStats();
00298 }

Here is the call graph for this function:

nsaddr_t Flow::dst  )  const [inline, inherited]
 

Definition at line 62 of file flowmon.h.

References Flow::dst_, and nsaddr_t.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00062 { return (dst_); }

int EDQueueMonitor::ebdrops  )  const [inline, inherited]
 

Definition at line 265 of file queue-monitor.h.

References EDQueueMonitor::ebdrops_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00265 { return (ebdrops_); }

void EDQueueMonitor::edrop Packet p  )  [inline, virtual, inherited]
 

Reimplemented from QueueMonitor.

Reimplemented in FlowMon.

Definition at line 247 of file queue-monitor.h.

References hdr_cmn::access(), QueueMonitor::drop(), EDQueueMonitor::ebdrops_, EDQueueMonitor::epdrops_, and hdr_cmn::size().

Referenced by FlowMon::edrop().

00247                               {
00248                 hdr_cmn* hdr = hdr_cmn::access(p);
00249                 ebdrops_ += hdr->size();
00250                 epdrops_++;
00251                 // remove later - ratul
00252                 // printf("My epdrops = %d\n",epdrops_);
00253                 QueueMonitor::drop(p);
00254         }

Here is the call graph for this function:

int EDQueueMonitor::epdrops  )  const [inline, inherited]
 

Definition at line 264 of file queue-monitor.h.

References EDQueueMonitor::epdrops_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00264 { return (epdrops_); }

void QueueMonitor::estimateRate Packet p  )  [protected, inherited]
 

Definition at line 301 of file queue-monitor.cc.

References hdr_cmn::access(), Scheduler::clock(), QueueMonitor::estRate_, Scheduler::instance(), QueueMonitor::k_, QueueMonitor::prevTime_, hdr_cmn::size(), and QueueMonitor::temp_size_.

Referenced by QueueMonitor::in().

00301                                            {
00302         
00303         hdr_cmn* hdr  = hdr_cmn::access(pkt);
00304         int pktSize   = hdr->size() << 3; /* length of the packet in bits */
00305 
00306         double now = Scheduler::instance().clock();
00307         double timeGap = ( now - prevTime_);
00308 
00309         if (timeGap == 0) {
00310                 temp_size_ += pktSize;
00311                 return;
00312         }
00313         else {
00314                 pktSize+= temp_size_;
00315                 temp_size_ = 0;
00316         }
00317         
00318         prevTime_ = now;
00319         
00320         estRate_ = (1 - exp(-timeGap/k_))*((double)pktSize)/timeGap + exp(-timeGap/k_)*estRate_;
00321 }

Here is the call graph for this function:

int Flow::flowid  )  const [inline, inherited]
 

Definition at line 63 of file flowmon.h.

References Flow::fid_.

Referenced by RedPDQueue::command(), FlowMon::fformat(), and Tagger::fformat().

00063 { return (fid_); }

void QueueMonitor::in Packet  )  [virtual, inherited]
 

Reimplemented in Tagger, FlowMon, and QueueMonitorCompat.

Definition at line 223 of file queue-monitor.cc.

References hdr_cmn::access(), QueueMonitor::barrivals_, QueueMonitor::bytesInt_, QueueMonitor::channel_, Scheduler::clock(), QueueMonitor::delaySamp_, QueueMonitor::estimate_rate_, QueueMonitor::estimateRate(), Scheduler::instance(), Integrator::newPoint(), QueueMonitor::parrivals_, QueueMonitor::pkts_, QueueMonitor::pktsInt_, QueueMonitor::prevTime_, QueueMonitor::printStats(), hdr_cmn::size(), QueueMonitor::size_, and hdr_cmn::timestamp().

Referenced by QueueMonitorCompat::in(), FlowMon::in(), Tagger::in(), SnoopQueueTagger::recv(), and SnoopQueueIn::recv().

00224 {
00225         hdr_cmn* hdr = hdr_cmn::access(p);
00226         double now = Scheduler::instance().clock();
00227         int pktsz = hdr->size();
00228 
00229         //if enabled estimate rate now
00230         if (estimate_rate_) {
00231                 estimateRate(p);
00232         }
00233         else {
00234                 prevTime_ = now;
00235         }
00236 
00237         barrivals_ += pktsz;
00238         parrivals_++;
00239         size_ += pktsz;
00240         pkts_++;
00241         if (bytesInt_)
00242                 bytesInt_->newPoint(now, double(size_));
00243         if (pktsInt_)
00244                 pktsInt_->newPoint(now, double(pkts_));
00245         if (delaySamp_)
00246                 hdr->timestamp() = now;
00247         if (channel_)
00248                 printStats();
00249 
00250 }

Here is the call graph for this function:

void QueueMonitor::keepRTTstats Packet p  )  [protected, inherited]
 

Definition at line 324 of file queue-monitor.cc.

References hdr_tcp::access(), hdr_cmn::access(), QueueMonitor::binsPerSec_, hdr_tcp::last_rtt(), QueueMonitor::maxRTT_, QueueMonitor::numRTTs_, packet_t, PT_FTP, PT_HTTP, PT_TCP, PT_TELNET, hdr_cmn::ptype(), and QueueMonitor::RTTbins_.

Referenced by QueueMonitor::out().

00324                                            {
00325         int i, j, topBin, rttInMs, MsPerBin;
00326         hdr_cmn* hdr  = hdr_cmn::access(pkt);
00327         packet_t t = hdr->ptype();
00328         if (t == PT_TCP || t == PT_HTTP || t == PT_FTP || t == PT_TELNET) {
00329                 hdr_tcp *tcph = hdr_tcp::access(pkt);
00330                 rttInMs = tcph->last_rtt(); 
00331                 if (rttInMs < 0) rttInMs = 0;
00332                 topBin = maxRTT_ * binsPerSec_;
00333                 if (numRTTs_ == 0) {
00334                         RTTbins_ = (int *)malloc(sizeof(int)*topBin);
00335                         for (i = 0; i < topBin; i++) {
00336                                 RTTbins_[i] = 0;
00337                         }
00338                 }
00339                 MsPerBin = int(1000/binsPerSec_);
00340                 j = (int)(rttInMs/MsPerBin);
00341                 if (j < 0) j = 0;
00342                 if (j >= topBin) j = topBin - 1;
00343                 ++ RTTbins_[j];
00344                 ++ numRTTs_;
00345         }
00346 }

Here is the call graph for this function:

void QueueMonitor::keepSeqnoStats Packet p  )  [protected, inherited]
 

Definition at line 349 of file queue-monitor.cc.

References hdr_tcp::access(), hdr_cmn::access(), QueueMonitor::maxSeqno_, QueueMonitor::numSeqnos_, packet_t, PT_FTP, PT_HTTP, PT_TCP, PT_TELNET, hdr_cmn::ptype(), hdr_tcp::seqno(), QueueMonitor::SeqnoBins_, and QueueMonitor::SeqnoBinSize_.

Referenced by QueueMonitor::out().

00349                                              {
00350         int i, j, topBin, seqno; 
00351         hdr_cmn* hdr  = hdr_cmn::access(pkt);
00352         packet_t t = hdr->ptype();
00353         if (t == PT_TCP || t == PT_HTTP || t == PT_FTP || t == PT_TELNET) {
00354                 hdr_tcp *tcph = hdr_tcp::access(pkt);
00355                 seqno = tcph->seqno(); 
00356                 if (seqno < 0) seqno = 0;
00357                 topBin = int(maxSeqno_ / SeqnoBinSize_);
00358                 if (numSeqnos_ == 0) {
00359                         SeqnoBins_ = (int *)malloc(sizeof(int)*topBin);
00360                         for (i = 0; i < topBin; i++) {
00361                                 SeqnoBins_[i] = 0;
00362                         }
00363                 }
00364                 j = (int)(seqno/SeqnoBinSize_);
00365                 if (j < 0) j = 0;
00366                 if (j >= topBin) j = topBin - 1;
00367                 ++ SeqnoBins_[j];
00368                 ++ numSeqnos_;
00369         }
00370 }

Here is the call graph for this function:

int EDQueueMonitor::mon_ebdrops  )  const [inline, inherited]
 

Definition at line 267 of file queue-monitor.h.

References EDQueueMonitor::mon_ebdrops_.

Referenced by PushbackQueue::timeout().

00267 { return (mon_ebdrops_); }

void EDQueueMonitor::mon_edrop Packet p  )  [inline, inherited]
 

Reimplemented in FlowMon.

Definition at line 256 of file queue-monitor.h.

References hdr_cmn::access(), QueueMonitor::drop(), EDQueueMonitor::mon_ebdrops_, EDQueueMonitor::mon_epdrops_, and hdr_cmn::size().

Referenced by PushbackQueue::enque(), and FlowMon::mon_edrop().

00256                                   {
00257                 hdr_cmn* hdr = hdr_cmn::access(p);
00258                 mon_ebdrops_ += hdr->size();
00259                 mon_epdrops_++;
00260         
00261                 QueueMonitor::drop(p);
00262         }

Here is the call graph for this function:

int EDQueueMonitor::mon_epdrops  )  const [inline, inherited]
 

Definition at line 266 of file queue-monitor.h.

References EDQueueMonitor::mon_epdrops_.

00266 { return (mon_epdrops_); }

void QueueMonitor::out Packet  )  [virtual, inherited]
 

Reimplemented in FlowMon, and QueueMonitorCompat.

Definition at line 252 of file queue-monitor.cc.

References hdr_flags::access(), hdr_cmn::access(), QueueMonitor::bdepartures_, QueueMonitor::bytesInt_, hdr_flags::ce(), QueueMonitor::channel_, Scheduler::clock(), QueueMonitor::delaySamp_, hdr_flags::ect(), Scheduler::instance(), QueueMonitor::keepRTTstats(), QueueMonitor::keepRTTstats_, QueueMonitor::keepSeqnoStats(), QueueMonitor::keepSeqnoStats_, Samples::newPoint(), Integrator::newPoint(), QueueMonitor::pdepartures_, QueueMonitor::pkts_, QueueMonitor::pktsInt_, QueueMonitor::pmarks_, QueueMonitor::printStats(), hdr_cmn::size(), QueueMonitor::size_, and hdr_cmn::timestamp().

Referenced by QueueMonitorCompat::out(), FlowMon::out(), and SnoopQueueOut::recv().

00253 {
00254         hdr_cmn* hdr = hdr_cmn::access(p);
00255         hdr_flags* pf = hdr_flags::access(p);
00256         double now = Scheduler::instance().clock();
00257         int pktsz = hdr->size();
00258 
00259         if (pf->ce() && pf->ect()) 
00260                 pmarks_++;
00261         size_ -= pktsz;
00262         pkts_--;
00263         bdepartures_ += pktsz;
00264         pdepartures_++;
00265         if (bytesInt_)
00266                 bytesInt_->newPoint(now, double(size_));
00267         if (pktsInt_)
00268                 pktsInt_->newPoint(now, double(pkts_));
00269         if (delaySamp_)
00270                 delaySamp_->newPoint(now - hdr->timestamp());
00271 
00272         if (keepRTTstats_) {
00273                 keepRTTstats(p);
00274         }
00275         if (keepSeqnoStats_) {
00276                 keepSeqnoStats(p);
00277         }
00278         if (channel_)
00279                 printStats();
00280 }

Here is the call graph for this function:

int QueueMonitor::parrivals  )  const [inline, inherited]
 

Definition at line 100 of file queue-monitor.h.

References QueueMonitor::parrivals_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00100 { return (parrivals_); }

int QueueMonitor::pdepartures  )  const [inline, inherited]
 

Definition at line 102 of file queue-monitor.h.

References QueueMonitor::pdepartures_.

00102 { return (pdepartures_); }

int QueueMonitor::pdrops  )  const [inline, inherited]
 

Definition at line 105 of file queue-monitor.h.

References QueueMonitor::pdrops_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00105 { return (pdrops_); }

int QueueMonitor::pkts  )  const [inline, inherited]
 

Definition at line 93 of file queue-monitor.h.

References QueueMonitor::pkts_.

Referenced by CBQClass::demand(), and CBQueue::toplevel_departure().

00093 { return (pkts_); }

int QueueMonitor::pmarks  )  const [inline, inherited]
 

Definition at line 106 of file queue-monitor.h.

References QueueMonitor::pmarks_.

Referenced by Tagger::fformat().

00106 { return (pmarks_); }

void QueueMonitor::printRTTs  )  [inherited]
 

Definition at line 150 of file queue-monitor.cc.

References QueueMonitor::binsPerSec_, QueueMonitor::channel1_, Scheduler::clock(), Scheduler::instance(), QueueMonitor::maxRTT_, QueueMonitor::numRTTs_, and QueueMonitor::RTTbins_.

Referenced by QueueMonitor::command().

00150                         {
00151         int i, n, topBin, MsPerBin;
00152         char wrk[500];
00153 
00154         topBin = maxRTT_ * binsPerSec_;
00155         MsPerBin = int(1000/binsPerSec_);
00156         double now = Scheduler::instance().clock();
00157         sprintf(wrk, "Distribution of RTTs, %d ms bins, time %4.2f\n", MsPerBin, now);
00158         n = strlen(wrk); wrk[n] = 0;
00159         (void)Tcl_Write(channel1_, wrk, n);
00160         for (i = 0; i < topBin; i++) {
00161                 if (RTTbins_[i] > 0) {
00162                         sprintf(wrk, "%d to %d ms: frac %5.3f num %d time %4.2f\n", 
00163                           i*MsPerBin, (i+1)*MsPerBin, 
00164                           (double)RTTbins_[i]/numRTTs_,
00165                           RTTbins_[i], now); 
00166                         n = strlen(wrk); wrk[n] = 0; 
00167                         (void)Tcl_Write(channel1_, wrk, n);
00168                 }
00169         }
00170         i = topBin - 1;
00171         if (RTTbins_[i] > 0) {
00172                 sprintf(wrk, "The last bin might also contain RTTs >= %d ms.\n",
00173                 (i+1)*MsPerBin);
00174                 n = strlen(wrk); wrk[n] = 0;
00175                 (void)Tcl_Write(channel1_, wrk, n);
00176         }
00177 }

Here is the call graph for this function:

void QueueMonitor::printSeqnos  )  [inherited]
 

Definition at line 180 of file queue-monitor.cc.

References QueueMonitor::channel1_, Scheduler::clock(), Scheduler::instance(), QueueMonitor::maxSeqno_, QueueMonitor::numSeqnos_, QueueMonitor::SeqnoBins_, and QueueMonitor::SeqnoBinSize_.

Referenced by QueueMonitor::command().

00180                           {
00181         int i, n, topBin; 
00182         char wrk[500];
00183 
00184         topBin = int(maxSeqno_ / SeqnoBinSize_);
00185         double now = Scheduler::instance().clock();
00186         sprintf(wrk, "Distribution of Seqnos, %d seqnos per bin, time %4.2f\n", 
00187            SeqnoBinSize_, now);
00188         n = strlen(wrk); wrk[n] = 0;
00189         (void)Tcl_Write(channel1_, wrk, n);
00190         for (i = 0; i < topBin; i++) {
00191                 if (SeqnoBins_[i] > 0) {
00192                         sprintf(wrk, "%d to %d seqnos: frac %5.3f num %d time %4.2f\n", 
00193                           i*SeqnoBinSize_, (i+1)*SeqnoBinSize_ - 1, 
00194                           (double)SeqnoBins_[i]/numSeqnos_,
00195                           SeqnoBins_[i], now); 
00196                         n = strlen(wrk); wrk[n] = 0;
00197                         (void)Tcl_Write(channel1_, wrk, n);
00198                 }
00199         }
00200         i = topBin - 1;
00201         if (SeqnoBins_[i] > 0) {
00202                 sprintf(wrk, "The last bin might also contain Seqnos >= %d. \n",
00203                 (i+1)*SeqnoBinSize_);
00204                 n = strlen(wrk); wrk[n] = 0;
00205                 (void)Tcl_Write(channel1_, wrk, n);
00206         }
00207 }

Here is the call graph for this function:

void QueueMonitor::printStats  )  [inherited]
 

Definition at line 210 of file queue-monitor.cc.

References QueueMonitor::channel_, Scheduler::clock(), QueueMonitor::dstId_, Scheduler::instance(), QueueMonitor::pkts_, QueueMonitor::size_, QueueMonitor::srcId_, and TIME_FORMAT.

Referenced by QueueMonitor::drop(), QueueMonitor::in(), and QueueMonitor::out().

00210                          {
00211         char wrk[500];
00212         int n;
00213         double now = Scheduler::instance().clock();
00214         sprintf(wrk, "q -t "TIME_FORMAT" -s %d -d %d -l %d -p %d", now, srcId_, dstId_, size_, pkts_);
00215         n = strlen(wrk);
00216         wrk[n] = '\n';
00217         wrk[n+1] = 0;
00218         (void)Tcl_Write(channel_, wrk, n+1);
00219         wrk[n] = 0;
00220 }       

Here is the call graph for this function:

packet_t Flow::ptype  )  const [inline, inherited]
 

Definition at line 64 of file flowmon.h.

References packet_t, and Flow::type_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00064 { return (type_); }

void TaggerTSWFlow::run_rate_estimator Packet p,
double  now
[inline]
 

Definition at line 142 of file flowmon.h.

References hdr_cmn::access(), avg_rate_, hdr_cmn::size_, t_front_, and win_len_.

Referenced by tagging().

00142                                                       {
00143 
00144                 hdr_cmn* hdr = hdr_cmn::access(p);
00145                 double bytes_in_tsw = avg_rate_ * win_len_;
00146                 double new_bytes    = bytes_in_tsw + hdr->size_;
00147                 avg_rate_ = new_bytes / (now - t_front_ + win_len_);
00148                 t_front_  = now;
00149         }

Here is the call graph for this function:

void Flow::setfields Packet p  )  [inline, inherited]
 

Definition at line 65 of file flowmon.h.

References hdr_cmn::access(), hdr_ip::access(), hdr_ip::daddr(), Flow::dst_, Flow::fid_, hdr_ip::flowid(), hdr_cmn::ptype(), hdr_ip::saddr(), Flow::src_, and Flow::type_.

Referenced by FlowMon::drop(), FlowMon::edrop(), FlowMon::in(), Tagger::in(), FlowMon::mon_edrop(), and FlowMon::out().

00065                                   {
00066                 hdr_ip* hdr = hdr_ip::access(p);
00067                 hdr_cmn* chdr = hdr_cmn::access(p);
00068                 src_ = hdr->saddr();
00069                 dst_ = hdr->daddr();
00070                 fid_ = hdr->flowid();
00071                 type_ = chdr->ptype();
00072         }

Here is the call graph for this function:

int QueueMonitor::size  )  const [inline, inherited]
 

Definition at line 92 of file queue-monitor.h.

References QueueMonitor::size_.

00092 { return (size_); }

nsaddr_t Flow::src  )  const [inline, inherited]
 

Definition at line 61 of file flowmon.h.

References nsaddr_t, and Flow::src_.

Referenced by FlowMon::fformat(), and Tagger::fformat().

00061 { return (src_); }

void TaggerTSWFlow::tagging Packet  )  [virtual]
 

Reimplemented from Flow.

Definition at line 48 of file flowmon.cc.

References hdr_flags::access(), avg_rate_, Scheduler::clock(), count, Scheduler::instance(), hdr_flags::pri_, run_rate_estimator(), target_rate_, total_in, total_out, Random::uniform(), and wait_.

00049 {
00050         double now = Scheduler::instance().clock();;
00051         double  p, prob, u;
00052         int count1;
00053         int retVal;
00054 
00055         run_rate_estimator(pkt, now);
00056 
00057         if (avg_rate_ <= target_rate_) {
00058                 prob = 0;
00059                 retVal = 0;
00060         }
00061         else {
00062                prob = (avg_rate_ - target_rate_) / avg_rate_;
00063                p    = prob;
00064                count1 = count;
00065 
00066                if ( p < 0.5) {
00067                  if (wait_) {
00068                    if (count1 * p < 1)
00069                      p = 0;
00070                    else if (count1 * p < 2)
00071                      p /= (2 - count1 *p);
00072                    else
00073                      p = 1;
00074                  }
00075                  else if (!wait_) {
00076                    if (count1 * p < 1)
00077                      p /= (1 - count1 * p);
00078                    else
00079                      p = 1;
00080                  }
00081                }
00082 
00083                 u = Random::uniform();
00084                 if (u < p) {
00085                     retVal = 1;
00086                 }
00087                 else
00088                   retVal = 0;
00089 
00090 //                if (trace_) {
00091 //                  sprintf(trace_->buffer(), "Tagged prob %g, p %g, count %d",
00092 //                          prob, p, count1);
00093 //                  trace_->dump();
00094 //                }
00095         }
00096 
00097         if (retVal == 0) {
00098             hdr_flags::access(pkt)->pri_=1; //Tag the packet as In.
00099             total_in = total_in + 1;
00100             ++count;
00101         }
00102         else {
00103             total_out = total_out + 1;
00104             count = 0;
00105         }
00106 };

Here is the call graph for this function:


Member Data Documentation

double TaggerTSWFlow::avg_rate_ [protected]
 

Definition at line 154 of file flowmon.h.

Referenced by run_rate_estimator(), TaggerTSWFlow(), and tagging().

int QueueMonitor::barrivals_ [protected, inherited]
 

Definition at line 130 of file queue-monitor.h.

Referenced by QueueMonitor::barrivals(), QueueMonitor::in(), and QueueMonitor::QueueMonitor().

int QueueMonitor::bdepartures_ [protected, inherited]
 

Definition at line 132 of file queue-monitor.h.

Referenced by QueueMonitor::bdepartures(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

int QueueMonitor::bdrops_ [protected, inherited]
 

Definition at line 136 of file queue-monitor.h.

Referenced by QueueMonitor::bdrops(), QueueMonitor::drop(), and QueueMonitor::QueueMonitor().

int QueueMonitor::binsPerSec_ [protected, inherited]
 

Definition at line 141 of file queue-monitor.h.

Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor().

Integrator* QueueMonitor::bytesInt_ [protected, inherited]
 

Definition at line 117 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

Tcl_Channel QueueMonitor::channel1_ [protected, inherited]
 

Definition at line 153 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::printRTTs(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor().

Tcl_Channel QueueMonitor::channel_ [protected, inherited]
 

Reimplemented in Tagger, and FlowMon.

Definition at line 152 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor().

int TaggerTSWFlow::count [protected]
 

Definition at line 156 of file flowmon.h.

Referenced by tagging().

Samples* QueueMonitor::delaySamp_ [protected, inherited]
 

Definition at line 119 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

nsaddr_t Flow::dst_ [protected, inherited]
 

Definition at line 77 of file flowmon.h.

Referenced by Flow::dst(), Flow::Flow(), and Flow::setfields().

int QueueMonitor::dstId_ [protected, inherited]
 

Definition at line 151 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor().

int EDQueueMonitor::ebdrops_ [protected, inherited]
 

Definition at line 269 of file queue-monitor.h.

Referenced by EDQueueMonitor::ebdrops(), EDQueueMonitor::EDQueueMonitor(), and EDQueueMonitor::edrop().

int EDQueueMonitor::epdrops_ [protected, inherited]
 

Definition at line 270 of file queue-monitor.h.

Referenced by EDQueueMonitor::EDQueueMonitor(), EDQueueMonitor::edrop(), and EDQueueMonitor::epdrops().

int QueueMonitor::estimate_rate_ [inherited]
 

Definition at line 160 of file queue-monitor.h.

Referenced by RedPDQueue::command(), QueueMonitor::in(), and QueueMonitor::QueueMonitor().

double QueueMonitor::estRate_ [inherited]
 

Definition at line 162 of file queue-monitor.h.

Referenced by RedPDQueue::command(), RedPDQueue::enque(), QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor().

int Flow::fid_ [protected, inherited]
 

Definition at line 78 of file flowmon.h.

Referenced by Flow::Flow(), Flow::flowid(), and Flow::setfields().

double QueueMonitor::k_ [inherited]
 

Definition at line 161 of file queue-monitor.h.

Referenced by QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor().

int QueueMonitor::keepRTTstats_ [protected, inherited]
 

Definition at line 138 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

int QueueMonitor::keepSeqnoStats_ [protected, inherited]
 

Definition at line 144 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

int QueueMonitor::maxRTT_ [protected, inherited]
 

Definition at line 139 of file queue-monitor.h.

Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor().

int QueueMonitor::maxSeqno_ [protected, inherited]
 

Definition at line 145 of file queue-monitor.h.

Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor().

int EDQueueMonitor::mon_ebdrops_ [protected, inherited]
 

Definition at line 271 of file queue-monitor.h.

Referenced by EDQueueMonitor::EDQueueMonitor(), EDQueueMonitor::mon_ebdrops(), and EDQueueMonitor::mon_edrop().

int EDQueueMonitor::mon_epdrops_ [protected, inherited]
 

Definition at line 272 of file queue-monitor.h.

Referenced by EDQueueMonitor::EDQueueMonitor(), EDQueueMonitor::mon_edrop(), and EDQueueMonitor::mon_epdrops().

int QueueMonitor::numRTTs_ [protected, inherited]
 

Definition at line 140 of file queue-monitor.h.

Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor().

int QueueMonitor::numSeqnos_ [protected, inherited]
 

Definition at line 146 of file queue-monitor.h.

Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor().

int QueueMonitor::parrivals_ [protected, inherited]
 

Definition at line 129 of file queue-monitor.h.

Referenced by QueueMonitor::in(), QueueMonitor::parrivals(), and QueueMonitor::QueueMonitor().

int QueueMonitor::pdepartures_ [protected, inherited]
 

Definition at line 131 of file queue-monitor.h.

Referenced by QueueMonitor::out(), QueueMonitor::pdepartures(), and QueueMonitor::QueueMonitor().

int QueueMonitor::pdrops_ [protected, inherited]
 

Definition at line 134 of file queue-monitor.h.

Referenced by QueueMonitor::drop(), QueueMonitor::pdrops(), and QueueMonitor::QueueMonitor().

int QueueMonitor::pkts_ [protected, inherited]
 

Reimplemented in QueueMonitorCompat.

Definition at line 121 of file queue-monitor.h.

Referenced by QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), QueueMonitor::pkts(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor().

Integrator* QueueMonitor::pktsInt_ [protected, inherited]
 

Definition at line 118 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor().

int QueueMonitor::pmarks_ [protected, inherited]
 

Definition at line 135 of file queue-monitor.h.

Referenced by QueueMonitor::out(), QueueMonitor::pmarks(), and QueueMonitor::QueueMonitor().

double QueueMonitor::prevTime_ [inherited]
 

Definition at line 163 of file queue-monitor.h.

Referenced by QueueMonitor::estimateRate(), QueueMonitor::in(), and QueueMonitor::QueueMonitor().

int* QueueMonitor::RTTbins_ [protected, inherited]
 

Definition at line 142 of file queue-monitor.h.

Referenced by QueueMonitor::keepRTTstats(), and QueueMonitor::printRTTs().

int* QueueMonitor::SeqnoBins_ [protected, inherited]
 

Definition at line 148 of file queue-monitor.h.

Referenced by QueueMonitor::keepSeqnoStats(), and QueueMonitor::printSeqnos().

int QueueMonitor::SeqnoBinSize_ [protected, inherited]
 

Definition at line 147 of file queue-monitor.h.

Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor().

int QueueMonitor::size_ [protected, inherited]
 

Definition at line 120 of file queue-monitor.h.

Referenced by QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), QueueMonitor::printStats(), QueueMonitor::QueueMonitor(), and QueueMonitor::size().

nsaddr_t Flow::src_ [protected, inherited]
 

Definition at line 76 of file flowmon.h.

Referenced by Flow::Flow(), Flow::setfields(), and Flow::src().

int QueueMonitor::srcId_ [protected, inherited]
 

Definition at line 150 of file queue-monitor.h.

Referenced by QueueMonitor::command(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor().

double QueueMonitor::startTime_ [inherited]
 

Definition at line 164 of file queue-monitor.h.

Referenced by QueueMonitor::QueueMonitor().

double TaggerTSWFlow::t_front_ [protected]
 

Definition at line 155 of file flowmon.h.

Referenced by run_rate_estimator(), and TaggerTSWFlow().

double TaggerTSWFlow::target_rate_ [protected]
 

Definition at line 152 of file flowmon.h.

Referenced by TaggerTSWFlow(), and tagging().

int QueueMonitor::temp_size_ [protected, inherited]
 

Definition at line 167 of file queue-monitor.h.

Referenced by QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor().

double TaggerTSWFlow::total_in [protected]
 

Definition at line 160 of file flowmon.h.

Referenced by TaggerTSWFlow(), and tagging().

double TaggerTSWFlow::total_out [protected]
 

Definition at line 161 of file flowmon.h.

Referenced by TaggerTSWFlow(), and tagging().

packet_t Flow::type_ [protected, inherited]
 

Definition at line 79 of file flowmon.h.

Referenced by Flow::Flow(), Flow::ptype(), and Flow::setfields().

int TaggerTSWFlow::wait_ [protected]
 

Definition at line 157 of file flowmon.h.

Referenced by TaggerTSWFlow(), and tagging().

double TaggerTSWFlow::win_len_ [protected]
 

Definition at line 153 of file flowmon.h.

Referenced by run_rate_estimator(), and TaggerTSWFlow().


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