您可以使用运行您的示例.waf
。导航到您的 ns-3 目录(其中.waf
可执行文件位于)并运行:
./waf --run tcp-variants-comparison
这将编译(如果需要)并使用默认参数运行示例。您可以使用更改参数--command-template="%s <args>"
。如果你看里面tcp-variants-comparison.cc您可以看到所有可用的参数,例如:
...
cmd.AddValue ("delay", "Access link delay", access_delay);
cmd.AddValue ("tracing", "Flag to enable/disable tracing", tracing);
cmd.AddValue ("tr_name", "Name of output trace file", tr_file_name);
cmd.AddValue ("cwnd_tr_name", "Name of output trace file", cwnd_tr_file_name);
...
这是一个如何存储默认拥塞窗口的示例TCP西木协议进程追踪 file:
./waf --run tcp-variants-comparison --command-template="%s --tracing=1 --cwnd_tr_name=cwndTrace"
然后您可以使用任何您喜欢的工具来显示数据。以下是如何绘制它gnuplot
:
$ gnuplot
gnuplot> set terminal png size 640,480
gnuplot> set output "cwnd.png"
gnuplot> plot "cwndTrace" using 1:2 title 'Congestion Window' with linespoints
gnuplot> exit
你还应该看看这个 NS-3 教程 https://www.nsnam.org/docs/tutorial/html/。这是对 NS-3 的很好的介绍,所以请仔细阅读。
因此,要完整回答您的问题,您可以使用此示例进行比较:
cmd.AddValue ("transport_prot", "Transport protocol to use: TcpTahoe, TcpReno, TcpNewReno, TcpWestwood, TcpWestwoodPlus ", transport_prot);
所以用不同的方式运行这个例子transport_prot
论证并比较你的痕迹。