26. Trace and Monitoring Support

The procedures and functions described in this chapter can be found in ~ns/trace.{cc, h}, ~ns/tcl/lib/ns-trace.tcl, ~ns/queue-monitor.{cc, h}, ~ns/tcl/lib/ns-link.tcl, ~ns/packet.h, ~ns/flowmon.cc, and ~ns/classifier-hash.cc.

There are a number of ways of collecting output or trace data on a simulation. Generally, trace data is either displayed directly during execution of the simulation, or (more commonly) stored in a file to be post-processed and analyzed. There are two primary but distinct types of monitoring capabilities currently supported by the simulator. The first, called traces, record each individual packet as it arrives, departs, or is dropped at a link or queue. Trace objects are configured into a simulation as nodes in the network topology, usually with a Tcl ``Channel'' object hooked to them, representing the destination of collected data (typically a trace file in the current directory). The other types of objects, called monitors, record counts of various interesting quantities such as packet and byte arrivals, departures, etc. Monitors can monitor counts associated with all packets, or on a per-flow basis using a flow monitor below (Section 26.7).

To support traces, there is a special common header included in each packet (this format is defined in ~ns/packet.h as hdr_cmn). It presently includes a unique identifier on each packet, a packet type field (set by agents when they generate packets), a packet size field (in bytes, used to determine the transmission time for packets), and an interface label (used for computing multicast distribution trees).

Monitors are supported by a separate set of objects that are created and inserted into the network topology around queues. They provide a place where arrival statistics and times are gathered and make use of the Integrator../ns-2/integrator.h (Section 25.3) to compute statistics over time intervals.

Tom Henderson 2011-11-05