📄 node272.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>23.6 Queue Monitoring</TITLE><META NAME="description" CONTENT="23.6 Queue Monitoring"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html"><LINK REL="previous" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><LINK REL="up" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html"><LINK REL="next" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html5471" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5465" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5459" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5467" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html5469" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html5472" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html">23.7 Per-Flow Monitoring</A><B> Up:</B> <A NAME="tex2html5466" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html">23. Trace and Monitoring</A><B> Previous:</B> <A NAME="tex2html5460" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html">23.5 Packet Types</A>   <B> <A NAME="tex2html5468" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5470" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION04360000000000000000"></A><A NAME="sec:qmonitor"></A><BR>23.6 Queue Monitoring</H1><P>Queue monitoring refers to the capability of tracking thedynamics of packets at a queue (or other object).A queue monitor tracks packet arrival/departure/drop statistics,and may optionally compute averages of these values.Monitoring may be applied to all packets (aggregate statistics), orper-flow statistics (using a Flow Monitor).<P>Several classes are used in supporting queue monitoring.When a packet arrives at a link where queue monitoring is enabled,it generally passes through a <TT>SnoopQueue</TT> object when itarrives and leaves (or is dropped).These objects contain a reference to a <TT>QueueMonitor</TT> object.<P>A <TT>QueueMonitor</TT> is defined as follows (queue-monitor.cc):<PRE> class QueueMonitor : public TclObject { public: QueueMonitor() : bytesInt_(NULL), pktsInt_(NULL), delaySamp_(NULL), size_(0), pkts_(0), parrivals_(0), barrivals_(0), pdepartures_(0), bdepartures_(0), pdrops_(0), bdrops_(0), srcId_(0), dstId_(0), channel_(0) { bind("size_", &size_); bind("pkts_", &pkts_); bind("parrivals_", &parrivals_); bind("barrivals_", &barrivals_); bind("pdepartures_", &pdepartures_); bind("bdepartures_", &bdepartures_); bind("pdrops_", &pdrops_); bind("bdrops_", &bdrops_); bind("off_cmn_", &off_cmn_); }; int size() const { return (size_); } int pkts() const { return (pkts_); } int parrivals() const { return (parrivals_); } int barrivals() const { return (barrivals_); } int pdepartures() const { return (pdepartures_); } int bdepartures() const { return (bdepartures_); } int pdrops() const { return (pdrops_); } int bdrops() const { return (bdrops_); } void printStats(); virtual void in(Packet*); virtual void out(Packet*); virtual void drop(Packet*); virtual void edrop(Packet*) { abort(); }; // not here virtual int command(int argc, const char*const* argv); \ldots // packet arrival to a queue void QueueMonitor::in(Packet* p) { hdr_cmn* hdr = (hdr_cmn*)p-\>access(off_cmn_); double now = Scheduler::instance().clock(); int pktsz = hdr-\>size(); barrivals_ += pktsz; parrivals_++; size_ += pktsz; pkts_++; if (bytesInt_) bytesInt_-\>newPoint(now, double(size_)); if (pktsInt_) pktsInt_-\>newPoint(now, double(pkts_)); if (delaySamp_) hdr-\>timestamp() = now; if (channel_) printStats(); } \ldots \fcn[]{in}, \fcn[]{out}, \fcn[]{drop} are all defined similarly \ldots</PRE>It addition to the packet and byte counters, a queue monitormay optionally refer to objects that keep an integralof the queue size over time using<TT>Integrator</TT> objects, which are defined in Section <A HREF="node261.html#sec:integral" tppabs="http://www.isi.edu/nsnam/ns/doc/node261.html#sec:integral">22.3</A>.The <TT>Integrator</TT> class provides a simple implementation ofintegral approximation by discrete sums.<P>All bound variables beginning with <B>p</B> refer to packet counts, andall variables beginning with <B>b</B> refer to byte counts.The variable <TT>size_</TT> records the instantaneous queue size in bytes,and the variable <TT>pkts_</TT> records the same value in packets.When a <TT>QueueMonitor</TT> is configured to include the integralfunctions (on bytes or packets or both), itcomputes the approximate integral of thequeue size (in bytes)with respect to time over the interval , where is either the start of the simulation or the last time the<TT>sum<BR>_</TT> field of the underlying <TT>Integrator</TT> class was reset.<P>The <TT>QueueMonitor</TT> class is not derived from <TT>Connector</TT>, andis not linked directly into the network topology.Rather, objects of the <TT>SnoopQueue</TT> class (or its derived classes)are inserted into the network topology, and these objects contain referencesto an associated queue monitor.Ordinarily, multiple <TT>SnoopQueue</TT> objects will refer to the samequeue monitor.Objects constructed out of these classes are linked in the simulationtopology as described above and call <TT>QueueMonitor</TT><TT>out</TT>, <TT>in</TT>, or <TT>drop</TT> procedures,depending on the particular type of snoopy queue.<P><HR><!--Navigation Panel--><A NAME="tex2html5471" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5465" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5459" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5467" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html5469" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html5472" HREF="node273.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node273.html">23.7 Per-Flow Monitoring</A><B> Up:</B> <A NAME="tex2html5466" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html">23. Trace and Monitoring</A><B> Previous:</B> <A NAME="tex2html5460" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html">23.5 Packet Types</A>   <B> <A NAME="tex2html5468" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5470" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -