Jan 4, 2012
One NS2 old trace format analysis
After NS2 simulations are finished, someone may need to analyze the trace file which is output by TCL program. I got the trace file format which is like this
"s 38.212991274 _2_ MAC --- 86 MYTYPE 178 [13a 3 2 800] ------- [2:0 3:0 30 3]"
"s 38.418136390 _3_ AGT --- 89 MYTYPE 100 [0 0 0 0] ------- [3:0 2:0 32 0]"
The first field is the event type, whose value can be s (send), r (receive), d (drop) or f (forward).
The second field the time this event happens.
The third field records the id of the node, on which this event takes place.
The fourth field shows the layer where this event happens. Its possible value may be one of the following four: AGT (agent), RTR (router), IFQ (interface queue), and MAC (mac).
The fifth field is normally a short broken line, which is reserved for special events. For example, when collision occurs, the broken line is replaced with COL.
The sixth field is the global sequence number for this packet, which is the integer number used to identify this packet in the whole network and distinguish it from others. Sequence number is only available for data packets and not allocated for control packets, like RTS/CTS/ACK and SYNC packets in S-MAC (using a zero instead).
The seventh field is the packet type. The actual value is determined by the application or MAC layer, which creates this packet. For example, cbr represents that it is a data packet generated by a CBR traffic source.
The eighth field is the packet size in bytes.
Since I use AODV routing protocol, the ninth field is AODV trace information including three numbers in brackets concerns MAC layer information. Usually, there will be four numbers in the brackets. Its format is like "[0x%x %d [%d %d] %f] (%s)" 1)| hexadecimal | Type | 2)| int | Hop Count | 3)|int | Destination | Destination Sequence Number | 4)|double | Lifetime | 5)|string | Operation (REPLY, ERROR, HELLO) |
The tenth field is IP trace info including | Source IP Address:Source Port Number | Destination IP Address:Destination Port Number | TTL Value | Next Hop Address, If Any |