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 ...

nmlab.korea.ac.kr
from nmlab.korea.ac.kr More from this publisher
12.07.2015 Views

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

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!