#include <queue-monitor.h>
Inheritance diagram for QueueMonitorCompat:


Public Member Functions | |
| QueueMonitorCompat () | |
| void | in (Packet *) |
| void | out (Packet *) |
| void | drop (Packet *) |
| int | command (int argc, const char *const *argv) |
| 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 | edrop (Packet *) |
Public Attributes | |
| int | estimate_rate_ |
| double | k_ |
| double | estRate_ |
| double | prevTime_ |
| double | startTime_ |
Protected Member Functions | |
| void | flowstats (int flowid) |
| void | estimateRate (Packet *p) |
| void | keepRTTstats (Packet *p) |
| void | keepSeqnoStats (Packet *p) |
Protected Attributes | |
| int | pkts_ [MAXFLOW] |
| int | bytes_ [MAXFLOW] |
| int | drops_ [MAXFLOW] |
| Samples * | flowstats_ [MAXFLOW] |
| Integrator * | bytesInt_ |
| Integrator * | pktsInt_ |
| Samples * | delaySamp_ |
| int | size_ |
| 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_ |
|
|
Definition at line 436 of file queue-monitor.cc. References bytes_, drops_, flowstats_, and pkts_.
00437 {
00438 memset(pkts_, 0, sizeof(pkts_));
00439 memset(bytes_, 0, sizeof(bytes_));
00440 memset(drops_, 0, sizeof(drops_));
00441 memset(flowstats_, 0, sizeof(flowstats_));
00442 }
|
|
|
Definition at line 101 of file queue-monitor.h. References QueueMonitor::barrivals_. Referenced by FlowMon::fformat(), Tagger::fformat(), and PushbackQueue::timeout().
00101 { return (barrivals_); }
|
|
|
Definition at line 103 of file queue-monitor.h. References QueueMonitor::bdepartures_. Referenced by PushbackQueue::timeout().
00103 { return (bdepartures_); }
|
|
|
Definition at line 107 of file queue-monitor.h. References QueueMonitor::bdrops_. Referenced by FlowMon::fformat(), Tagger::fformat(), and PushbackQueue::timeout().
00107 { return (bdrops_); }
|
|
||||||||||||
|
Reimplemented from QueueMonitor. Definition at line 519 of file queue-monitor.cc. References abort(), bytes_, QueueMonitor::command(), drops_, flowstats(), flowstats_, MAXFLOW, and pkts_.
00520 {
00521 Tcl& tcl = Tcl::instance();
00522 int fid;
00523 if (argc == 3) {
00524 fid = atoi(argv[2]);
00525 if (strcmp(argv[1], "bytes") == 0) {
00526 if (fid >= MAXFLOW) {
00527 abort();
00528 /*NOTREACHED*/
00529 }
00530 tcl.resultf("%d", bytes_[fid]);
00531 return TCL_OK;
00532 } else if (strcmp(argv[1], "pkts") == 0) {
00533 if (fid >= MAXFLOW) {
00534 abort();
00535 /*NOTREACHED*/
00536 }
00537 tcl.resultf("%d", pkts_[fid]);
00538 return TCL_OK;
00539 } else if (strcmp(argv[1], "drops") == 0) {
00540 if (fid >= MAXFLOW) {
00541 abort();
00542 /*NOTREACHED*/
00543 }
00544 tcl.resultf("%d", drops_[fid]);
00545 return TCL_OK;
00546 } else if (strcmp(argv[1], "get-class-delay-samples") == 0) {
00547 if (fid >= MAXFLOW) {
00548 abort();
00549 /*NOTREACHED*/
00550 }
00551 if (flowstats_[fid] == 0) {
00552 /*
00553 * instantiate one if user actually
00554 * cares enough to ask for it!
00555 *
00556 * (otherwise, need to return "",
00557 * and then special-case caller to
00558 * handle this null return.)
00559 */
00560 flowstats(fid);
00561 }
00562 tcl.resultf("%s", flowstats_[fid]->name());
00563 return TCL_OK;
00564 }
00565 }
00566 return (QueueMonitor::command(argc, argv));
00567 }
|
Here is the call graph for this function:

|
|
Reimplemented from QueueMonitor. Definition at line 506 of file queue-monitor.cc. References abort(), hdr_ip::access(), QueueMonitor::drop(), drops_, hdr_ip::flowid(), and MAXFLOW.
00507 {
00508
00509 hdr_ip* iph = hdr_ip::access(pkt);
00510 int fid = iph->flowid();
00511 if (fid >= MAXFLOW) {
00512 abort();
00513 /*NOTREACHED*/
00514 }
00515 ++drops_[fid];
00516 QueueMonitor::drop(pkt);
00517 }
|
Here is the call graph for this function:

|
|
Reimplemented in FlowMon, and EDQueueMonitor. Definition at line 114 of file queue-monitor.h. References abort(). Referenced by SnoopQueueEDrop::recv().
00114 { abort(); }; // not here
|
Here is the call graph for this function:

|
|
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:

|
|
Definition at line 450 of file queue-monitor.cc. References abort(), and flowstats_. Referenced by command(), and out().
00451 {
00452 Tcl& tcl = Tcl::instance();
00453
00454 /*
00455 * here is the deal. we are in C code. we'd like to do
00456 * flowstats_[flowid] = new Samples;
00457 * but, we want to create an object that can be
00458 * referenced via tcl. (in particular, we want ->name_
00459 * to be valid.)
00460 *
00461 * so, how do we do this?
00462 *
00463 * well, the answer is, call tcl to create it. then,
00464 * do a lookup on the result from tcl!
00465 */
00466
00467 tcl.evalf("new Samples");
00468 flowstats_[flowid] = (Samples*)TclObject::lookup(tcl.result());
00469 if (flowstats_[flowid] == 0) {
00470 abort();
00471 /*NOTREACHED*/
00472 }
00473 }
|
Here is the call graph for this function:

|
|
Reimplemented from QueueMonitor. Definition at line 497 of file queue-monitor.cc. References hdr_cmn::access(), Scheduler::clock(), QueueMonitor::in(), Scheduler::instance(), and hdr_cmn::timestamp().
00498 {
00499 hdr_cmn* hdr = hdr_cmn::access(pkt);
00500 double now = Scheduler::instance().clock();
00501 // QueueMonitor::in() *may* do this, but we always need it...
00502 hdr->timestamp() = now;
00503 QueueMonitor::in(pkt);
00504 }
|
Here is the call graph for this function:

|
|
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:

|
|
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:

|
|
Reimplemented from QueueMonitor. Definition at line 476 of file queue-monitor.cc. References abort(), hdr_ip::access(), hdr_cmn::access(), bytes_, Scheduler::clock(), hdr_ip::flowid(), flowstats(), flowstats_, Scheduler::instance(), MAXFLOW, Samples::newPoint(), QueueMonitor::out(), pkts_, hdr_cmn::size(), and hdr_cmn::timestamp().
00477 {
00478 hdr_cmn* hdr = hdr_cmn::access(pkt);
00479 hdr_ip* iph = hdr_ip::access(pkt);
00480 double now = Scheduler::instance().clock();
00481 int fid = iph->flowid();
00482
00483 if (fid >= MAXFLOW) {
00484 abort();
00485 /*NOTREACHED*/
00486 }
00487 // printf("QueueMonitorCompat::out(), fid=%d\n", fid);
00488 bytes_[fid] += hdr_cmn::access(pkt)->size();
00489 pkts_[fid]++;
00490 if (flowstats_[fid] == 0) {
00491 flowstats(fid);
00492 }
00493 flowstats_[fid]->newPoint(now - hdr->timestamp());
00494 QueueMonitor::out(pkt);
00495 }
|
Here is the call graph for this function:

|
|
Definition at line 100 of file queue-monitor.h. References QueueMonitor::parrivals_. Referenced by FlowMon::fformat(), and Tagger::fformat().
00100 { return (parrivals_); }
|
|
|
Definition at line 102 of file queue-monitor.h. References QueueMonitor::pdepartures_.
00102 { return (pdepartures_); }
|
|
|
Definition at line 105 of file queue-monitor.h. References QueueMonitor::pdrops_. Referenced by FlowMon::fformat(), and Tagger::fformat().
00105 { return (pdrops_); }
|
|
|
Definition at line 93 of file queue-monitor.h. References QueueMonitor::pkts_. Referenced by CBQClass::demand(), and CBQueue::toplevel_departure().
00093 { return (pkts_); }
|
|
|
Definition at line 106 of file queue-monitor.h. References QueueMonitor::pmarks_. Referenced by Tagger::fformat().
00106 { return (pmarks_); }
|
|
|
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:

|
|
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:

|
|
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:

|
|
Definition at line 92 of file queue-monitor.h. References QueueMonitor::size_.
00092 { return (size_); }
|
|
|
Definition at line 130 of file queue-monitor.h. Referenced by QueueMonitor::barrivals(), QueueMonitor::in(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 132 of file queue-monitor.h. Referenced by QueueMonitor::bdepartures(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 136 of file queue-monitor.h. Referenced by QueueMonitor::bdrops(), QueueMonitor::drop(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 141 of file queue-monitor.h. Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 304 of file queue-monitor.h. Referenced by command(), out(), and QueueMonitorCompat(). |
|
|
Definition at line 117 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 153 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::printRTTs(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor(). |
|
|
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(). |
|
|
Definition at line 119 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 305 of file queue-monitor.h. Referenced by command(), drop(), and QueueMonitorCompat(). |
|
|
Definition at line 151 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 160 of file queue-monitor.h. Referenced by RedPDQueue::command(), QueueMonitor::in(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 162 of file queue-monitor.h. Referenced by RedPDQueue::command(), RedPDQueue::enque(), QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 306 of file queue-monitor.h. Referenced by command(), flowstats(), out(), and QueueMonitorCompat(). |
|
|
Definition at line 161 of file queue-monitor.h. Referenced by QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 138 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 144 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 139 of file queue-monitor.h. Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 145 of file queue-monitor.h. Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 140 of file queue-monitor.h. Referenced by QueueMonitor::keepRTTstats(), QueueMonitor::printRTTs(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 146 of file queue-monitor.h. Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 129 of file queue-monitor.h. Referenced by QueueMonitor::in(), QueueMonitor::parrivals(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 131 of file queue-monitor.h. Referenced by QueueMonitor::out(), QueueMonitor::pdepartures(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 134 of file queue-monitor.h. Referenced by QueueMonitor::drop(), QueueMonitor::pdrops(), and QueueMonitor::QueueMonitor(). |
|
|
Reimplemented from QueueMonitor. Definition at line 303 of file queue-monitor.h. Referenced by command(), out(), and QueueMonitorCompat(). |
|
|
Definition at line 118 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 135 of file queue-monitor.h. Referenced by QueueMonitor::out(), QueueMonitor::pmarks(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 163 of file queue-monitor.h. Referenced by QueueMonitor::estimateRate(), QueueMonitor::in(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 142 of file queue-monitor.h. Referenced by QueueMonitor::keepRTTstats(), and QueueMonitor::printRTTs(). |
|
|
Definition at line 148 of file queue-monitor.h. Referenced by QueueMonitor::keepSeqnoStats(), and QueueMonitor::printSeqnos(). |
|
|
Definition at line 147 of file queue-monitor.h. Referenced by QueueMonitor::keepSeqnoStats(), QueueMonitor::printSeqnos(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 120 of file queue-monitor.h. Referenced by QueueMonitor::drop(), QueueMonitor::in(), QueueMonitor::out(), QueueMonitor::printStats(), QueueMonitor::QueueMonitor(), and QueueMonitor::size(). |
|
|
Definition at line 150 of file queue-monitor.h. Referenced by QueueMonitor::command(), QueueMonitor::printStats(), and QueueMonitor::QueueMonitor(). |
|
|
Definition at line 164 of file queue-monitor.h. Referenced by QueueMonitor::QueueMonitor(). |
|
|
Definition at line 167 of file queue-monitor.h. Referenced by QueueMonitor::estimateRate(), and QueueMonitor::QueueMonitor(). |
1.3.3