[Ns-developers] For Review: Redo ASCII and pcap Tracing

craigdo@ee.washington.edu craigdo at ee.washington.edu
Thu Jan 28 22:48:18 PST 2010


Hi All,

I have previously mentioned that I am working on a cleanup of the way ASCII
and pcap tracing is done.  The ultimate goals are:

1) To introduce object names into trace file names;
2) To get away from the situation we are in where we need to modify some
large number of source files to change tracing;
3) To use a common pcap trace file base class previously introduced in the
test framework work;
4) To move away from an all-knowledgeable trace-writer that has to be
modified to add or change trace formats;
5) To provide a mid-level helper to make it easier to make the connection
between trace hooks and trace files;
6) Make the user visible tracing framework more consistent;
7) Address other problems, especially in internet-stack.

This is now ready for review.  I created an issue at
http://codereview.appspot.com/196058 that holds all of the changes.

I provide a repository at http://code.nsnam.org/craigdo/ns-3-pcap-redo that
has all of the changes and is in sync with ns-3-dev as of tonight (1/28/10).

This is a significant changeset.  There are lots of changed files, many of
which you can safely ignore

- Don't bother to look at any of the bindings/* files -- this is just noise,
but I include them to show that all of the bindings have been updated and
work;
- Many of the changes are just changes from static functions to method
invocations.

If I may, the best place to start is probably in the tutorial.  I have
updated doc/tutorial/tracing.text with a bunch of words about how to deal
with tracing.  This should illustrate what I've done and help get your
bearings with respect to the rest of the changes.  The sixth.cc example
shows how easy it is now to hook new sources and write traces to files.

I would recommend looking at src/helper/csma-helper.{cc,h} next.  This
should illustrate what is required of a device helper that uses this new
framework.  It's not much, and all of the other device helpers now do a
substantially similar thing.  Notice that there is a bunch of new ascii
trace functionality that I think is useful and was easy to implement in the
mixins.

Perhaps look at src/helper/internet-stack-helper.{cc,h} for a protocol point
of view.  This turned out to be a lot more complicated than the device
helpers because trace hooks are specified by protocol (e.g., Ptr<Ipv4>,
there are multiple protocols (Ipv4 and Ipv6) and the helpers look at things
from a protocol/interface point of view (see how Ipv4InterfaceContainer is
used if you don't know what I mean).  It was a bit of work to get pcap and
ascii tracing to work similarly to the helpers that use the node/device
model, but I think it turned out well from a user point of view.  There is a
bunch of new functionality here as well and some serious problems were
addressed WRT the old version.

Finally, the heavy lifting force is done in trace-helper.{cc.h}.  The
"correct" way to do this would have been through mixins.  Unfortunately,
pybindgen doesn't support multiple inheritance so I had to linearize the
inheritance hierarchy.  This led to some funny class names and inheritance
patterns, but this is all hidden at the level of device and protocol helpers
and above.

The regression tests and test.py all pass with one exception.  In
examples/routing/dynamic-global-routing you will notice some extra context
in the .tr files coming from the internet stack.  This is because it
currently is impossible to tell what interface the dropped packets originate
from.  So I added the interface in parentheses at the end of the context.
If you want to see the regression tests pass, then comment out the #define
INTERFACE_CONTEXT in internet-stack.cc

I have the radiotap header re-implemented.  I don't have the prism header
implemented because I don't have the code available, and I don't have any
use case to test it with (it's not tested in regression or test.py).  If one
of you has the header implementation laying around, it will be easy to dump
it in.

I haven't done performance measurements yet to quantify the impact of adding
the header before writing the pcap traces out, but if it becomes a problem,
like the old joke, I just won't do that.

I made one change to ns3modulegen.py to remove the constraint against
inheritance for classes that have a name ending in Helper.

Anyway, your comments and suggestions are welcome.  I'd like to get this
into ns-3 dev soon for the ns-3.8 release.

Regards,

-- Craig












http://code.nsnam.org/craigdo/ns-3-pcap-redo






More information about the Ns-developers mailing list