12.07.2015 Views

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

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 26Trace <strong>and</strong> Monitoring Support<strong>The</strong> procedures <strong>and</strong> functio<strong>ns</strong> described in this chapter can be found in ~<strong>ns</strong>/trace.{cc, h}, ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-trace.tcl, ~<strong>ns</strong>/queuemonitor.{cc,h}, ~<strong>ns</strong>/tcl/lib/<strong>ns</strong>-link.tcl, ~<strong>ns</strong>/packet.h, ~<strong>ns</strong>/flowmon.cc, <strong>and</strong> ~<strong>ns</strong>/classifier-hash.cc.<strong>The</strong>re are a number of ways of collecting output or trace d<strong>at</strong>a on a simul<strong>at</strong>ion. Generally, trace d<strong>at</strong>a is either displayed directlyduring execution of the simul<strong>at</strong>ion, or (more commonly) stored in a file to be post-processed <strong>and</strong> analyzed. <strong>The</strong>re are twoprimary but distinct types of monitoring capabilities currently supported by the simul<strong>at</strong>or. <strong>The</strong> first, called traces, record eachindividual packet as it arrives, departs, or is dropped <strong>at</strong> a link or queue. Trace objects are configured into a simul<strong>at</strong>ion as nodesin the network topology, usually with a Tcl “Channel” object hooked to them, representing the destin<strong>at</strong>ion of collected d<strong>at</strong>a(typically a trace file in the current directory). <strong>The</strong> other types of objects, called monitors, record counts of various interestingquantities such as packet <strong>and</strong> byte arrivals, departures, etc. Monitors can monitor counts associ<strong>at</strong>ed with all packets, or on aper-flow basis using a flow monitor below (Section 26.7).To support traces, there is a special common header included in each packet (this form<strong>at</strong> is defined in ~<strong>ns</strong>/packet.h ashdr_cmn). It presently includes a unique identifier on each packet, a packet type field (set by agents when they gener<strong>at</strong>epackets), a packet size field (in bytes, used to determine the tra<strong>ns</strong>mission time for packets), <strong>and</strong> an interface label (usedfor computing multicast distribution trees).Monitors are supported by a separ<strong>at</strong>e set of objects th<strong>at</strong> are cre<strong>at</strong>ed <strong>and</strong> i<strong>ns</strong>erted into the network topology around queues.<strong>The</strong>y provide a place where arrival st<strong>at</strong>istics <strong>and</strong> times are g<strong>at</strong>hered <strong>and</strong> make use of the class Integr<strong>at</strong>or (Section 25.3)to compute st<strong>at</strong>istics over time intervals.26.1 Trace Support<strong>The</strong> trace support in OTcl co<strong>ns</strong>ists of a number of specialized classes visible in OTcl but implemented in C++, combined witha set of Tcl helper procedures <strong>and</strong> classes defined in the <strong>ns</strong> library.All following OTcl classes are supported by underlying C++ classes defined in ~<strong>ns</strong>/trace.cc. Objects of the following typesare i<strong>ns</strong>erted directly in-line in the network topology:230

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

Saved successfully!

Ooh no, something went wrong!