📄 node267.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.1.1 OTcl Helper Functions</TITLE><META NAME="description" CONTENT="23.1.1 OTcl Helper Functions"><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="previous" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><LINK REL="up" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><LINK REL="next" HREF="node268.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html5401" HREF="node268.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5395" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5391" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5397" 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="tex2html5399" 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="tex2html5402" HREF="node268.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html">23.2 Library support and</A><B> Up:</B> <A NAME="tex2html5396" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html">23.1 Trace Support</A><B> Previous:</B> <A NAME="tex2html5392" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html">23.1 Trace Support</A>   <B> <A NAME="tex2html5398" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5400" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H2><A NAME="SECTION04311000000000000000"></A><A NAME="sec:helptrace"></A><BR>23.1.1 OTcl Helper Functions</H2><P>The following helper functions may be used within simulationscripts to help in attaching trace elements (see tcl/lib/ns-lib.tcl);they are instance procedures of the class Simulator:<P><TABLE CELLPADDING=3 WIDTH="100%"><TR><TD ALIGN="RIGHT"><TT>flush-trace {}</TT></TD><TD ALIGN="LEFT">flush buffers for all trace objects in simulation</TD></TR><TR><TD ALIGN="RIGHT"><TT>create-trace { type file src dst }</TT></TD><TD ALIGN="LEFT">create a trace object of type <EM>type</EM> between the given src and dest nodes. If <EM>file</EM> is non-null, it is interpreted as a Tcl channel and is attached to the newly-created trace object. The procedure returns the handle to the newly created trace object.</TD></TR><TR><TD ALIGN="RIGHT"><TT>trace-queue { n1 n2 file }</TT></TD><TD ALIGN="LEFT">arrange for tracing on the link between nodes <EM>n1</EM> and <EM>n2</EM>. This function calls create-trace, so the same rules apply with respect to the <EM>file</EM> argument.</TD></TR><TR><TD ALIGN="RIGHT"><TT>trace-callback{ ns command }</TT></TD><TD ALIGN="LEFT">arranges to call <TT>command</TT> when a line is to be traced. The procedure treats <TT>command</TT> as a string and evaluates it for every line traced. See tcl/ex/callback_demo.tcl for additional details on usage.</TD></TR><TR><TD ALIGN="RIGHT"><TT>monitor-queue { n1 n2 }</TT></TD><TD ALIGN="LEFT">this function calls the <TT>init-monitor</TT> function on the link between nodes <EM>n1</EM> and <EM>n2</EM>.</TD></TR><TR><TD ALIGN="RIGHT"><TT>drop-trace { n1 n2 trace }</TT></TD><TD ALIGN="LEFT">the given <EM>trace</EM> object is made the drop-target of the queue associated with the link between nodes <EM>n1</EM> and <EM>n2</EM>.</TD></TR></TABLE><P>The []create-trace procedure is used to create a new <TT>Trace</TT>object of the appropriate kind and attach an Tcl I/O channel to it(typically a file handle).The <TT>src<BR>_</TT> and <TT>dst<BR>_</TT> fields are are used by the underlying C++object for producing the trace output file so that trace outputcan include the node addresses defining the endpoints of the link whichis being traced.Note that they are not used for <EM>matching</EM>. Specifically, thesevalues in no way relate to the packet header <TT>src</TT> and <TT>dst</TT>fields, which are also displayed when tracing.See the description of the <TT>Trace</TT> class below (Section <A HREF="node269.html#sec:tracemoncplus" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html#sec:tracemoncplus">23.3</A>).<P>The <TT>trace-queue</TT> function enables<TT>Enque</TT>, <TT>Deque</TT>, and <TT>Drop</TT> tracing on the linkbetween nodes <TT>n1</TT> and <TT>n2</TT>.The Link <TT>trace</TT> procedure is described below (Section <A HREF="node268.html#sec:libexam" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html#sec:libexam">23.2</A>).<P>The <TT>monitor-queue</TT> function is constructed similarly to<TT>trace-queue</TT>.By calling the link's <TT>init-monitor</TT> procedure, it arrangesfor the creation of objects (<TT>SnoopQueue</TT> and <TT>QueueMonitor</TT>objects) which can, in turn, be used to ascertain time-aggregatedqueue statistics.<P>The <TT>drop-trace</TT> function provides a way to specify a<TT>Queue</TT>'s drop target without having a direct handle ofthe queue.<P><HR><!--Navigation Panel--><A NAME="tex2html5401" HREF="node268.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5395" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html5391" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5397" 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="tex2html5399" 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="tex2html5402" HREF="node268.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node268.html">23.2 Library support and</A><B> Up:</B> <A NAME="tex2html5396" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html">23.1 Trace Support</A><B> Previous:</B> <A NAME="tex2html5392" HREF="node266.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node266.html">23.1 Trace Support</A>   <B> <A NAME="tex2html5398" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5400" 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 + -