📄 node270.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.4 Trace File Format</TITLE><META NAME="description" CONTENT="23.4 Trace File Format"><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="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><LINK REL="previous" HREF="node269.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html"><LINK REL="up" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html"><LINK REL="next" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html5443" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5437" 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="tex2html5431" HREF="node269.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5439" 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="tex2html5441" 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="tex2html5444" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html">23.5 Packet Types</A><B> Up:</B> <A NAME="tex2html5438" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html">23. Trace and Monitoring</A><B> Previous:</B> <A NAME="tex2html5432" HREF="node269.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html">23.3 The C++ Trace</A>   <B> <A NAME="tex2html5440" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5442" 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="SECTION04340000000000000000"></A><A NAME="sec:traceformat"></A><BR>23.4 Trace File Format</H1><P>The []Trace::format method defines the trace file format usedin trace files produced by the <TT>Trace</TT> class.It is constructed to maintain backward compatibility with output filesin earlier versions of the simulator (, v1) so that v1post-processing scripts continue to operate.The important pieces of its implementation are as follows:<PRE> // this function should retain some backward-compatibility, so that // scripts don't break. void Trace::format(int tt, int s, int d, Packet* p) { hdr_cmn *th = (hdr_cmn*)p-\>access(off_cmn_); hdr_ip *iph = (hdr_ip*)p-\>access(off_ip_); hdr_tcp *tcph = (hdr_tcp*)p-\>access(off_tcp_); hdr_rtp *rh = (hdr_rtp*)p-\>access(off_rtp_); packet_t t = th-\>ptype(); const char* name = packet_info.name(t); if (name == 0) abort(); int seqno; /* XXX */ /* CBR's now have seqno's too */ if (t == PT_RTP || t == PT_CBR) seqno = rh-\>seqno(); else if (t == PT_TCP || t == PT_ACK) seqno = tcph-\>seqno(); else seqno = -1; \ldots if (!show_tcphdr_) { sprintf(wrk_, "%c %g %d %d %s %d %s %d %d.%d %d.%d %d %d", tt, Scheduler::instance().clock(), s, d, name, th-\>size(), flags, iph-\>flowid() /* was p-\>class_ */, iph-\>src() \>\> 8, iph-\>src() & 0xff, // XXX iph-\>dst() \>\> 8, iph-\>dst() & 0xff, // XXX seqno, th-\>uid() /* was p-\>uid_ */); } else { sprintf(wrk_, "%c %g %d %d %s %d %s %d %d.%d %d.%d %d %d %d 0x%x %d", tt, Scheduler::instance().clock(), s, d, name, th-\>size(), flags, iph-\>flowid() /* was p-\>class_ */, iph-\>src() \>\> 8, iph-\>src() & 0xff, // XXX iph-\>dst() \>\> 8, iph-\>dst() & 0xff, // XXX seqno, th-\>uid(), /* was p-\>uid_ */ tcph-\>ackno(), tcph-\>flags(), tcph-\>hlen()); }</PRE>This function is somewhat unelegant, primarily due to the desireto maintain backward compatibility.It formats the source, destination, and type fields defined in thetrace object (<EM>not in the packet headers</EM>), the current time,along with various packet header fields including,type of packet (as a name), size, flags (symbolically),flow identifier, source and destination packet header fields,sequence number (if present), and unique identifier.The <TT>show_tcphdr_</TT> variable indicates whether the traceoutput should append tcp header information (ack number, flags, header length)at the end of each output line.This is especially useful for simulations usingFullTCP agents (Section <A HREF="node387.html#sec:fulltcp" tppabs="http://www.isi.edu/nsnam/ns/doc/node387.html#sec:fulltcp">31.3</A>).An example of a trace file (without the tcp header fields) mightappear as follows: <PRE>+ 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610- 1.84375 0 2 cbr 210 ------- 0 0.0 3.1 225 610r 1.84471 2 1 cbr 210 ------- 1 3.0 1.0 195 600r 1.84566 2 0 ack 40 ------- 2 3.2 0.1 82 602+ 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611- 1.84566 0 2 tcp 1000 ------- 2 0.1 3.2 102 611r 1.84609 0 2 cbr 210 ------- 0 0.0 3.1 225 610+ 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610d 1.84609 2 3 cbr 210 ------- 0 0.0 3.1 225 610- 1.8461 2 3 cbr 210 ------- 0 0.0 3.1 192 511r 1.84612 3 2 cbr 210 ------- 1 3.0 1.0 196 603+ 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603- 1.84612 2 1 cbr 210 ------- 1 3.0 1.0 196 603+ 1.84625 3 2 cbr 210 ------- 1 3.0 1.0 199 612</PRE>Here we see 14 trace entries, five enque operations (indicated by ``+''in the first column), four deque operations (indicated by ``-''),four receive events (indicated by ``r''), and one drop event.(this had better be a trace fragment, orsome packets would have just vanished!).The simulated time (in seconds) at which each event occurred is listedin the second column.The next two fields indicate between which two nodes tracing is happening.The next field is a descriptive name for the the type of packet seen (Section <A HREF="node271.html#sec:traceptype" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html#sec:traceptype">23.5</A>).The next field is the packet's size, as encoded in its IP header.<P>The next field contains the flags, which not used in this example.The flags are defined in the flags[] array in trace.cc. Four of the flags are used for ECN:``E'' for Congestion Experienced (CE) and ``N'' for ECN-Capable-Transport (ECT) indicationsin the IP header, and ``C'' for ECN-Echo and ``A'' for Congestion Window Reduced (CWR) in the TCP header.For the other flags, ``P'' is for priority, and ``F'' is for TCP Fast Start.<P>The next field gives the IP <EM>flow identifier</EM> field as definedfor IP version 6.<A NAME="tex2html52" HREF="footnode.html#foot10471" tppabs="http://www.isi.edu/nsnam/ns/doc/footnode.html#foot10471"><SUP>23.1</SUP></A>.The subsequent two fields indicate the packet's source and destinationnode addresses, respectively.The following field indicates the sequence number.<A NAME="tex2html53" HREF="footnode.html#foot10362" tppabs="http://www.isi.edu/nsnam/ns/doc/footnode.html#foot10362"><SUP>23.2</SUP></A>The last field is a unique packet identifier. Each new packetcreated in the simulation is assigned a new, unique identifier.<P><HR><!--Navigation Panel--><A NAME="tex2html5443" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html5437" 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="tex2html5431" HREF="node269.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html5439" 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="tex2html5441" 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="tex2html5444" HREF="node271.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node271.html">23.5 Packet Types</A><B> Up:</B> <A NAME="tex2html5438" HREF="node265.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node265.html">23. Trace and Monitoring</A><B> Previous:</B> <A NAME="tex2html5432" HREF="node269.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node269.html">23.3 The C++ Trace</A>   <B> <A NAME="tex2html5440" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html5442" 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 + -