📄 analysis.html
字号:
<html>
<head>
<title>Trace Analysis Example</title>
</head>
<body background="parchment.gif" tppabs="http://nile.wpi.edu/NS/Icons/parchment.gif" text="#000000" link="#0000FF"
vlink="#000080" alink="#FF0000">
<br>
<center><h2>Trace Analysis Example</h2></center>
<br><br>
<dl>
<p>This section shows a trace analysis example. Example 4 is the same OTcl script as the one in the "<a href="simple_ns.html" tppabs="http://nile.wpi.edu/NS/simple_ns.html">Simple Simulation Example</a>" section with a few lines added to open a trace file and write traces to it. For the network topology it generates and the simulation scenario, refer to <a href="simple_ns.html#fig4" tppabs="http://nile.wpi.edu/NS/simple_ns.html#fig4">Figure 4</a> in the "Simple Simulation Example" section. To run this script download "<a href="ns-simple-trace.tcl" tppabs="http://nile.wpi.edu/NS/Example/ns-simple-trace.tcl">ns-simple-trace.tcl</a>" and type "<font color=GREEN>ns ns-simple-trace.tcl</font>" at your shell prompt. </p>
<p align="center">
<a href="ns-simple-trace.tcl" tppabs="http://nile.wpi.edu/NS/Example/ns-simple-trace.tcl"><img src="ex4.gif" tppabs="http://nile.wpi.edu/NS/Figure/ex4.gif" border=1 alt="ns-simple-trace.tcl"></a><br><br>
<b>Example 4.</b> Trace Enabled Simple NS Simulation Script (modified from Example 3)
</p>
<p>Running the above script generates a NAM trace file that is going to be used as an input to NAM and a trace file called "<font color=RED>out.tr</font>" that will be used for our simulation analysis. Figure 13 shows the trace format and example trace data from "<font color=RED>out.tr</font>". </p>
<p align="center"><img src="fig13.gif" tppabs="http://nile.wpi.edu/NS/Figure/fig13.gif"><br><br>
<b>Figure 13.</b> Trace Format Example</p>
<p>Each trace line starts with an event (+, -, d, r) descriptor followed by the simulation time (in seconds) of that event, and from and to node, which identify the link on which the event occurred. Look at <a href="components.html#fig9" tppabs="http://nile.wpi.edu/NS/components.html#fig9">Figure 9</a> in the "Network Components" section to see where in a link each type of event is traced. The next information in the line before flags (appeared as "------" since no flag is set) is packet type and size (in Bytes). Currently, NS implements only the Explicit Congestion Notification (ECN) bit, and the remaining bits are not used. The next field is flow id (fid) of IPv6 that a user can set for each flow at the input OTcl script. Even though fid field may not used in a simulation, users can use this field for analysis purposes. The fid field is also used when specifying stream color for the NAM display. The next two fields are source and destination address in forms of "node<b>.</b>port". The next field shows the network layer protocol's packet sequence number. Note that even though UDP implementations do not use sequence number, NS keeps track of UDP packet sequence number for analysis purposes. The last field shows the unique id of the packet. </p>
<p>Having simulation trace data at hand, all one has to do is to transform a subset of the data of interest into a comprehensible information and analyze it. Down below is a small data transformation example. This example uses a command written in perl called "column" that selects columns of given input. To make the example work on your machine, you should download "<a href="column.htm" tppabs="http://nile.wpi.edu/NS/Example/column">column</a>" and make it executable (i.e. "chmod 755 column"). Following is a tunneled shell command combined with <a href=" javascript:if(confirm('http://www.canberra.edu.au/~sam/whp/awk-guide.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.canberra.edu.au/~sam/whp/awk-guide.html'" tppabs="http://www.canberra.edu.au/~sam/whp/awk-guide.html" target=_top>awk</a>, which calculates CBR traffic jitter at receiver node (n3) using data in "<font color=RED>out.tr</font>", and stores the resulting data in "<font color=RED>jitter.txt</font>". </p>
<table align=CENTER width=570 cellpadding=0 cellspacing=0><tr><td>
<font face="Courier New" size="-1"><font color=GREEN>cat</font> <font color=RED>out.tr</font> | <font color=GREEN>grep</font> " 2 3 cbr " | <font color=GREEN>grep</font> ^r | <font color=GREEN>column</font> 1 10 | <font color=GREEN>awk</font> '{dif = $2 - old2; if(dif==0) dif = 1; if(dif > 0) {printf("%d\t%f\n", $2, ($1 - old1) / dif); old1 = $1; old2 = $2}}' <font color=GREEN>></font> <font color=RED>jitter.txt</font></font>
</td></tr></table>
<p>This shell command selects the "CBR packet receive" event at n3, selects time (column 1) and sequence number (column 10), and calculates the difference from last packet receive time divided by difference in sequence number (for loss packets) for each sequence number. The following is the corresponding jitter graph that is generated using <a href= "javascript:if(confirm('http://shazam.econ.ubc.ca/gnuplot.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://shazam.econ.ubc.ca/gnuplot.html'" tppabs="http://shazam.econ.ubc.ca/gnuplot.html" target=_top>gnuplot</a>. The X axis show the packet sequence number and the Y axis shows simulation time in seconds. </p>
<p align="center"><img src="fig14.gif" tppabs="http://nile.wpi.edu/NS/Figure/fig14.gif"><br><br>
<b>Figure 14.</b> CBR Jitter at The Receiving Node (n3)</p>
<p>You might also check for more utilities in the <a href="index-1.htm" tppabs="http://nile.wpi.edu/NS/utilities/"
target="nMain">Example Utilities</a> section.</p>
<p>This section showed an example of how to generate traces in NS, how to interpret them, and how to get useful information out from the traces. In this example, the post simulation processes are done in a shell prompt after the simulation. However, these processes can be included in the input OTcl script, which is shown in the next section. </p>
</dl>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -