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 |

2 comments:

  1. hi.

    i have face problem when i have generate xgraph using trace file

    like this

    Error in file `tr2.tr' at line 2046:
    Unknown line type
    Problems found with input data.

    i have used command like this

    xgraph tr2.tr

    how can i solve this proble ?

    pradeep.vanparia@gmail.com

    ReplyDelete
  2. my trace file formate is like this

    r 0.114 1 2 cbr 1000 ------- 2 1.0 3.1 0 0
    r 0.122 1 2 cbr 1000 ------- 2 1.0 3.1 1 1
    r 0.13 1 2 cbr 1000 ------- 2 1.0 3.1 2 2
    r 0.138 1 2 cbr 1000 ------- 2 1.0 3.1 3 3
    r 0.138706 2 3 cbr 1000 ------- 2 1.0 3.1 0 0
    r 0.146 1 2 cbr 1000 ------- 2 1.0 3.1 4 4
    r 0.146706 2 3 cbr 1000 ------- 2 1.0 3.1 1 1
    r 0.154 1 2 cbr 1000 ------- 2 1.0 3.1 5 5
    r 0.154706 2 3 cbr 1000 ------- 2 1.0 3.1 2 2
    r 0.162 1 2 cbr 1000 ------- 2 1.0 3.1 6 6
    r 0.162706 2 3 cbr 1000 ------- 2 1.0 3.1 3 3
    r 0.17 1 2 cbr 1000 ------- 2 1.0 3.1 7 7
    r 0.170706 2 3 cbr 1000 ------- 2 1.0 3.1 4 4
    r 0.178 1 2 cbr 1000 ------- 2 1.0 3.1 8 8
    r 0.178706 2 3 cbr 1000 ------- 2 1.0 3.1 5 5
    r 0.186 1 2 cbr 1000 ------- 2 1.0 3.1 9 9
    r 0.186706 2 3 cbr 1000 ------- 2 1.0 3.1 6 6

    ReplyDelete