49.1 Nam Trace Format

The C++ class Trace used for ns tracing is used for nam tracing as well. Description of this class may be found under section 26.3. The method Trace::format() defines nam format used in nam trace files which are used by nam for visualization of ns simulations. Trace class method Trace::format() is described in section 26.4 of chapter 26. If the macro NAM_TRACE has been defined (by default it is defined in trace.h), then the following code is executed as part of the Trace::format() function:

        if (namChan_ != 0)
                sprintf(nwrk_,
                        "%c -t "TIME_FORMAT" -s %d -d %d -p %s -e %d -c %d
-i %d -a %d -x {%s.%s %s.%s %d %s %s}",
                        tt,
                        Scheduler::instance().clock(),
                        s,
                        d,
                        name,
                        th-\>size(),
                        iph-\>flowid(),
                        th-\>uid(),
                        iph-\>flowid(),
                        src\_nodeaddr,
                        src\_portaddr,
                        dst\_nodeaddr,
                        dst\_portaddr,
                        seqno,flags,sname);

A nam trace file has a basic format to it. Each line is a nam event. The first character on the line defines the type of event and is followed by several flags to set options on that event. Each event is terminated by a newline character.

<event-type> -t <time> <more flags>...
Depending on the event type, there are different flags following the time flag.

There are 2 sections in that file, static intial configuration events and animation events. All events with -t * in them are configuration events and should be at the beginning of the file. One thing to note is that nam can also be fed the trace file from a stream which enables it to be used with realtime applications. See the section Using Streams with Realtime Applications for more information.

Following we describe nam trace file format for different classes events and animation objects.



Subsections
Tom Henderson 2011-11-05