next up previous contents index
Next: 22. Nam Trace Up: 21. Trace and Monitoring Previous: 21.7.3 The Flow Class

   
21.8 Commands at a glance

Following is a list of trace related commands commonly used in simulation scripts:

$ns_ trace-all tracefile
This is the command used to setup tracing in ns. All traces are written in the <tracefile>.

$ns_ namtrace-all namtracefile
This command sets up nam tracing in ns. All nam traces are written in to the <namtracefile>.

$ns_ namtrace-all-wireless namtracefile X Y
This command sets up wireless nam tracing. <X> and <Y> are the x-y co-ordinates for the wireless topology and all wireless nam traces are written into the <namtracefile>.

$ns_ nam-end-wireless stoptime
This tells nam the simulation stop time given in <stoptime>.

$ns_ trace-all-satlinks tracefile
This is a method to trace satellite links and write traces into <tracefile>.

$ns_ flush-trace
This command flushes the trace buffer and is typically called before the simulation run ends.

$ns_ get-nam-traceall
Returns the namtrace file descriptor stored as the Simulator instance variable called namtraceAllFile_.

$ns_ get-ns-traceall
Similar to get-nam-traceall. This returns the file descriptor for ns tracefile which is stored as the Simulator instance called traceAllFile_.

$ns_ create-trace type file src dst optional:op
This command creates a trace object of type <type> between the <src> and <dst> nodes. The traces are written into the <file>. <op> is the argument that may be used to specify the type of trace, like nam. if <op> is not defined, the default trace object created is for nstraces.

$ns_ trace-queue n1 n2 optional:file
This is a wrapper method for create-trace. This command creates a trace object for tracing events on the link represented by the nodes <n1> and <n2>.

$ns_ namtrace-queue n1 n2 optional:file
This is used to create a trace object for namtracing on the link between nodes <n1> and <n2>. This method is very similar to and is the namtrace counterpart of method trace-queue.

$ns_ drop-trace n1 n2 trace
This command makes the given <trace> object a drop-target for the queue associated with the link between nodes <n1> and <n2>.

$ns_ monitor-queue n1 n2 qtrace optional:sampleinterval
This sets up a monitor that keeps track of average queue length of the queue on the link between nodes <n1> and <n2>. The default value of sampleinterval is 0.1.

$link trace-dynamics ns fileID Trace the dynamics of this link and write the output to fileID filehandle. ns is an instance of the Simulator or MultiSim object that was created to invoke the simulation.

The tracefile format is backward compatible with the output files in the ns version 1 simulator so that ns-1 postprocessing scripts can still be used. Trace records of traffic for link objects with Enque, Deque, receive or Drop Tracing have the following form:

<code> <time> <hsrc> <hdst> <packet>

where

<code> := [hd+-] h=hop d=drop +=enque -=deque r=receive <time> :=
simulation time in seconds 
<hsrc> := first node address of hop/queuing link 
<hdst> := second node address of hop/queuing link 
<packet> := <type> <size> <flags> <flowID> <src.sport> <dst.dport> <seq>
<pktID> 
<type> := tcp|telnet|cbr|ack etc.
<size> := packet size in bytes
<flags> := [CP] C=congestion, P=priority 
<flowID> := flow identifier field as defined for IPv6 
<src.sport> := transport address (src=node,sport=agent) 
<dst.sport> := transport address (dst=node,dport=agent) 
<seq> := packet sequence number
<pktID> := unique identifer for every new packet

Only those agents interested in providing sequencing will generate sequence numbers and hence this field may not be useful for packets generated by some agents. For links that use RED gateways, there are additional trace records as follows:

<code> <time> <value>

where

<code> := [Qap] Q=queue size, a=average queue size, p=packet dropping
probability
<time> := simulation time in seconds 
<value> := value

Trace records for link dynamics are of the form:

<code> <time> <state> <src> <dst>

where

<code> := [v]
<time> := simulation time in seconds 
<state> := [link-up | link-down]
<src> := first node address of link 
<dst> := second node address of link


next up previous contents index
Next: 22. Nam Trace Up: 21. Trace and Monitoring Previous: 21.7.3 The Flow Class

2000-08-24