ns supports a multicast monitor module that can trace
user-defined packet activity.
The module counts the number of packets in transit periodically
and prints the results to specified files. []attach enables a
monitor module to print output to a file.
[]trace-topo insets monitor modules into all links.
[]filter allows accounting on specified packet header,
field in the header), and value for the field). Calling []filter
repeatedly will result in an AND effect on the filtering condition.
[]print-trace notifies the monitor module to begin dumping data.
ptype() is a global arrary that takes a packet type name (as seen in
[]trace-all output) and maps it into the corresponding value.
A simple configuration to filter cbr packets on a particular group is:
set mcastmonitor [new McastMonitor]
set chan [open cbr.tr w] # open trace file;
$mmonitor attach $chan1 # attach trace file to McastMoniotor object;
$mcastmonitor set period_ 0.02 # default 0.03 (sec);
$mmonitor trace-topo # trace entire topology;
$mmonitor filter Common ptype_ $ptype(cbr) # filter on ptype_ in Common header;
$mmonitor filter IP dst_ $group # AND filter on dst_ address in IP header;
$mmonitor print-trace # begin dumping periodic traces to specified files;
The following sample output illustrates the output file format (time, count):
0.16 0
0.17999999999999999 0
0.19999999999999998 0
0.21999999999999997 6
0.23999999999999996 11
0.25999999999999995 12
0.27999999999999997 12
Tom Henderson
2011-11-05