显示标签为“trace”的博文。显示所有博文
显示标签为“trace”的博文。显示所有博文

2009年3月18日星期三

NS-2 Trace Formats

NS-2 Trace Formats


This document lists various trace formats used by the NS-2 Network Simulator. The information is based on NS2 version 2.1b9a. The best effort has been made to document correctly all of the trace formats, but be warned that this list is not complete, and may contain errors. If you find any errors or omissions, please edit this page to fix the problems.

The various traces begin with a single character or abbreviation that indicates the type of trace, followed by a fixed or variable trace format. The tables listing the trace formats differ between fixed and variable trace formats:

  • For fixed trace formats, the table lists the event the triggers the trace under the Event heading and the characters that start the trace under the Abbreviation heading. The format is listed across the last two columns, and the the type and value for each element of the format are listed beneath under the Type and Value headings. Some events have multiple trace formats.
  • For variable trace formats, the table lists the event the triggers the trace under the Event heading and the characters that start the trace under the Abbreviation heading. The last three columns list the possible flags, types, and values for the event under the Flag, Type, and Value headings.

Normal trace formats

This information comes from "The ns Manual" "Trace and Monitoring Support: Trace File Format" chapter. This trace is used normal wired operations. The trace starts with one of four possible characters.

The tables that list the additional wireless trace information do not have an Abbreviation column, since the information is appended to the end of the regular wireless trace format.

Event Abbreviation Type Value
Normal Event r: Receive
d: Drop
e: Error
+: Enqueue
-: Dequeue
%g %d %d %s %d %s %d %d.%d %d.%d %d %d
double Time
int Source Node
int Destination Node
string Packet Name
int Packet Size
string Flags
int Flow ID
int Source Address
int Source Port
int Destination Address
int Destination Port
int Sequence Number
int Unique Packet ID

The flags are read as follow (the "value" is displayed instead of `-` if flag is set). Each row is one of the "slots", from left to right. From from ns/trace/trace.cc.

ValueMeaning
C ECN-echo
P pri_ (supposedly unused)
-
A Congestion Action
E Congestion Experienced (CE)
F Fast Start
N ECN-capable
SCTP-only

Depending on the packet type, the trace may log additional information:

Event Type Value
TCP Trace %d 0x%x %d %d
int Ack Number
hexadecimalFlags
int Header Length
int Socket Address Length
Satellite Trace %.2f %.2f %.2f %.2f
double Source Latitude
double Source Longitude
double Destination Latitude
double Destination Longitude

Wireless Trace Formats

This section covers the various wireless trace format:

Old Wireless Trace Formats

This information comes from "The ns Manual" "Mobile Networking in ns: Trace Support" chapter, and the "trace/cmu-trace.cc" file. Wireless traces begin with one of four characters followed by one of two different trace formats, depending on whether the trace logs the X and Y coordinates of the mobile node.

Event Abbreviation Type Value
Wireless Event s: Send
r: Receive
d: Drop
f: Forward
%.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x]
%.9f _%d_ %3s %4s %d %s %d [%x %x %x %x]
double Time
int Node ID
double X Coordinate (If Logging Position)
double Y Coordinate (If Logging Position)
string Trace Name
string Reason
int Event Identifier
string Packet Type
int Packet Size
hexadecimalTime To Send Data
hexadecimalDestination MAC Address
hexadecimalSource MAC Address
hexadecimalType (ARP, IP)

Some older versions of NS2 (such as 2.1b5) have five hexidecimal values between the square braces. The first hexidecimal value is the MAC frame control information, and the remaining hexidecimal values are the same as listed above.

Depending on the packet type, the trace may log additional information:

Event Type Value
ARP Trace ------- [%s %d/%d %d/%d]
string Request or Reply
int Source MAC Address
int Source Address
int Destination MAC Address
int Destination Address
IP Trace ------- [%d:%d %d:%d %d %d]
int Source IP Address
int Source Port
int Destination IP Address
int Destination Port Address
int TTL
int Next hop node (or 0 if not valid)
DSR Trace %d [%d %d] [%d %d %d %d->%d] [%d %d %d %d-

无线网络仿真Trace 旧格式

An example of a trace for a tcp packet is as follows:西子博客_$OOV"@*IQ

r 160.093884945_6_RTR---5 tcp 1492[a2 4 6 800]-------[65536:0 16777984:0 31 16777984][1 0]2 0ldN xs,x-LM0

7PQa F3NE0Here we see a TCP data packet being received by a node with id of 6.UID of this pkt is 5 with a cmn hdr size of 1492.The mac details shows an IP pkt(ETHERTYPE_IP is defined as 0x0800,ETHERTYPE_ARP is 0x0806),mac-id of this receiving node is 4.That of the sending node is 6 and expected time to send this data pkt over the wireless channel is a2(hex2dec conversion:160+2 sec).Additionally,IP traces information about IP src and destination addresses.The src translates(using a 3 level hier-address of 8/8/8)to a address string of 0.1.0 with port of 0.The dest address is 1.0.3 with port address of 0.The TTL value is 31 and the destination was a hop away from the src.Additionally TCP format prints information about tcp seqno of 1,ackno of 0.See other formats described in~ns//cmu-trace.cc for DSR,UDP/MESSAGE,TCP/ACK and CBR packet types.西子博客%PV:JlG+m}_R

西子博客%a,T Lgu*tOther trace formats are also used by the routing agents(TORA and DSR)to log certain special routing events like"originating"(adding a SR header to a packet)or"ran off the end of a source route"indicating some sort of routing problem with the source西子博客.~&G$z1~Cw"l
route etc.These special event traces begin with"S"for DSR and"T"for Tora and may be found in~ns/tora/tora.cc for TORA and~ns/dsr/dsrgent.cc for DSR routing agent.

(from: http://blog.hz0752.com/?uid-15519-action-viewspace-itemid-163973)