The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ... The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
voidFlowMon::fformat(Flow* f){double now = Scheduler::instance().clock();sprintf(wrk_, "%8.3f %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d%d",now,f->flowid(), // flowid0, // categoryf->ptype(), // type (from common header)f->flowid(), // flowid (formerly class)f->src(),f->dst(),f->parrivals(), // arrivals this flow (pkts)f->barrivals(), // arrivals this flow (bytes)f->epdrops(), // early drops this flow (pkts)f->ebdrops(), // early drops this flow (bytes)parrivals(), // all arrivals (pkts)barrivals(), // all arrivals (bytes)epdrops(), // total early drops (pkts)ebdrops(), // total early drops (bytes)pdrops(), // total drops (pkts)bdrops(), // total drops (bytes)f->pdrops(), // drops this flow (pkts) [includes edrops]f->bdrops() // drops this flow (bytes) [includes edrops]);};Most of the fields are explained in the code comments. The “category” is historical, but is used to maintain loose backwardcompatibilitywith the flow manager format in ns version 1.26.7.3 The Flow ClassThe class QueueMonitor/ED/Flow is used by the flow monitor for containing per-flow counters. As a subclass ofQueueMonitor, it inherits the standard counters for arrivals, departures, and drops, both in packets and bytes. In addition,because each flow is typically identified by some combination of the packet source, destination, and flow identifier fields,these objects contain such fields. Its OTcl interface contains only bound variables:src_dst_flowid_source address on packets for this flowdestination address on packets for this flowflow id on packets for this flowNote that packets may be mapped to flows (by classifiers) using criteria other than a src/dst/flowid triple. In such circumstances,only those fields actually used by the classifier in performing the packet-flow mapping should be considered reliable.26.8 Commands at a glanceFollowing is a list of trace related commands commonly used in simulation scripts:241
$ns_ trace-all This is the command used to setup tracing in ns. All traces are written in the .$ns_ namtrace-all This command sets up nam tracing in ns. All nam traces are written in to the .$ns_ namtrace-all-wireless This command sets up wireless nam tracing. and are the x-y co-ordinates for the wireless topology and allwireless nam traces are written into the .$ns_ nam-end-wireless This tells nam the simulation stop time given in .$ns_ trace-all-satlinks This is a method to trace satellite links and write traces into .$ns_ flush-traceThis command flushes the trace buffer and is typically called before the simulation run ends.$ns_ get-nam-traceallReturns the namtrace file descriptor stored as the Simulator instance variable called namtraceAllFile_.$ns_ get-ns-traceallSimilar to get-nam-traceall. This returns the file descriptor for ns tracefile which is stored as the Simulator instance calledtraceAllFile_.$ns_ create-trace This command creates a trace object of type between the and nodes. The traces are written into the. is the argument that may be used to specify the type of trace, like nam. if is not defined, the default traceobject created is for nstraces.$ns_ trace-queue This is a wrapper method for create-trace. This command creates a trace object for tracing events on the linkrepresented by the nodes and .$ns_ namtrace-queue This is used to create a trace object for namtracing on the link between nodes and . This method is very similar toand is the namtrace counterpart of method trace-queue.$ns_ drop-trace This command makes the given object a drop-target for the queue associated with the link between nodes and.$ns_ monitor-queue This sets up a monitor that keeps track of average queue length of the queue on the link between nodes and . Thedefault value of sampleinterval is 0.1.$link trace-dynamics 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 postprocessingscripts can still be used. Trace records of traffic for link objects with Enque, Deque, receive or Drop Tracing have thefollowing form: 242
- Page 191 and 192: 18.3.2 Using shadowing modelBefore
- Page 193 and 194: Chapter 19Energy Model in nsEnergy
- Page 195 and 196: Chapter 20Directed DiffusionThe dir
- Page 197 and 198: However if we have a large and dens
- Page 199 and 200: yr application in the ns context. T
- Page 201 and 202: value of opt(pre-stop) is usually t
- Page 203 and 204: 21.2 Implementation of XCP in NSIn
- Page 205 and 206: the persistent queue length in the
- Page 207 and 208: Thruput2 0.054024 60000residue_pos_
- Page 209 and 210: Chapter 22DelayBox: Per-Flow Delay
- Page 211 and 212: $ns attach-agent $n_sink $sink# mak
- Page 213 and 214: Chapter 23Changes made to the IEEE
- Page 215 and 216: Part IIISupport214
- Page 217 and 218: endenddocument pargvcPrint out argc
- Page 219 and 220: 24.4.2 Memory Conservation TipsSome
- Page 221 and 222: Chapter 25Mathematical SupportThe s
- Page 223 and 224: set run [lindex $argv 0]}if {$run <
- Page 225 and 226: }$sizeRNG next-substream# print the
- Page 227 and 228: protected:RNG* rng_;};Classes deriv
- Page 229 and 230: ns-random is implemented in ~ns/mis
- Page 231 and 232: Chapter 26Trace and Monitoring Supp
- Page 233 and 234: The monitor-queue function is const
- Page 235 and 236: also used to accumulate packet drop
- Page 237 and 238: }name,th->size(),flags,iph->flowid(
- Page 239 and 240: PT_TORA,PT_DSR,PT_AODV,// insert ne
- Page 241: The QueueMonitor class is not deriv
- Page 245 and 246: Chapter 27Test Suite SupportThe ns
- Page 247 and 248: ... ...}$ns_ at $opt(stop).1 "$self
- Page 249 and 250: Example: To enable debugging in Que
- Page 251 and 252: Chapter 29Unicast RoutingThis secti
- Page 253 and 254: Asymmetric Routing Asymmetric routi
- Page 255 and 256: class RouteLogic This class defines
- Page 257 and 258: — The procedure init-all{} is a g
- Page 259 and 260: Global Actions Once the detailed ac
- Page 261 and 262: This dumps next hop information in
- Page 263 and 264: $ns mrtproto ST;# specify shared tr
- Page 265 and 266: Dense Mode The Dense Mode protocol
- Page 267 and 268: and unique label (id). Thus, “inc
- Page 269 and 270: add-iif{ifid link},add-oif{link if}
- Page 271 and 272: CtrMcastComp is the centralised mul
- Page 273 and 274: $ns_ mrtproto This command specifi
- Page 275 and 276: Chapter 31Network DynamicsThis chap
- Page 277 and 278: v 0.8123 link-up 3 5v 0.8123 link-u
- Page 279 and 280: The first argument is the time at w
- Page 281 and 282: $ns_ rtmodel This command defines
- Page 283 and 284: $ns set-address-format hierarchical
- Page 285 and 286: 32.4 Hierarchical Routing with Sess
- Page 287 and 288: Chapter 33UDP Agents33.1 UDP Agents
- Page 289 and 290: Chapter 34TCP AgentsThis section de
- Page 291 and 292: set ns [new Simulator]set node1 [$n
voidFlowMon::fform<strong>at</strong>(Flow* f){double now = Scheduler::i<strong>ns</strong>tance().clock();sprintf(wrk_, "%8.3f %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d%d",now,f->flowid(), // flowid0, // c<strong>at</strong>egoryf->ptype(), // type (from common header)f->flowid(), // flowid (<strong>formerly</strong> class)f->src(),f->dst(),f->parrivals(), // arrivals this flow (pkts)f->barrivals(), // arrivals this flow (bytes)f->epdrops(), // early drops this flow (pkts)f->ebdrops(), // early drops this flow (bytes)parrivals(), // all arrivals (pkts)barrivals(), // all arrivals (bytes)epdrops(), // total early drops (pkts)ebdrops(), // total early drops (bytes)pdrops(), // total drops (pkts)bdrops(), // total drops (bytes)f->pdrops(), // drops this flow (pkts) [includes edrops]f->bdrops() // drops this flow (bytes) [includes edrops]);};Most of the fields are explained in the code comments. <strong>The</strong> “c<strong>at</strong>egory” is historical, but is used to maintain loose backwardcomp<strong>at</strong>ibilitywith the flow manager form<strong>at</strong> in <strong>ns</strong> version 1.26.7.3 <strong>The</strong> Flow Class<strong>The</strong> class QueueMonitor/ED/Flow is used by the flow monitor for containing per-flow counters. As a subclass ofQueueMonitor, it inherits the st<strong>and</strong>ard counters for arrivals, departures, <strong>and</strong> drops, both in packets <strong>and</strong> bytes. In addition,because each flow is typically identified by some combin<strong>at</strong>ion of the packet source, destin<strong>at</strong>ion, <strong>and</strong> flow identifier fields,these objects contain such fields. Its OTcl interface contai<strong>ns</strong> only bound variables:src_dst_flowid_source address on packets for this flowdestin<strong>at</strong>ion address on packets for this flowflow id on packets for this flowNote th<strong>at</strong> packets may be mapped to flows (by classifiers) using criteria other than a src/dst/flowid triple. In such circumstances,only those fields actually used by the classifier in performing the packet-flow mapping should be co<strong>ns</strong>idered reliable.26.8 Comm<strong>and</strong>s <strong>at</strong> a glanceFollowing is a list of trace rel<strong>at</strong>ed comm<strong>and</strong>s commonly used in simul<strong>at</strong>ion scripts:241