1 / 27

Analyzing NS2 result

Analyzing NS2 result. ECM 5078 Course Experiments Kang-Lun Fan NCTU Bun Lab. Oct 11 th 2007. Overview. ns2 Run ns case.tcl Results are recorded in .tr & .nam How to analyze the results? 1. prepare the trace file 2. use tools to obtain metrics from trace file Tools : awk , perl

fabian
Télécharger la présentation

Analyzing NS2 result

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Analyzing NS2 result ECM 5078 Course Experiments Kang-Lun Fan NCTU Bun Lab. Oct 11th 2007

  2. Overview ns2 • Run ns case.tcl • Results are recorded in .tr & .nam • How to analyze the results? • 1. prepare the trace file • 2. use tools to obtain metrics from trace file • Tools : awk,perl • Metrics : End-to-end delay,throughput, packet delivery rate

  3. Trace file (old) • .tr file • We only consider wireless case here • 2 format types • Record every action of transmission • MAC (RTS,CTS) • RTR (Routing) • Packet (send,receive,drop, etc.)

  4. Trace file (old) • Old Wireless Trace Formats • Different protocols (TORA,DSR) • Different levels (RTR, AGT, MAC) • Mobile or not • ns-2.29\trace\cmu-trace.cc • Manual Ch.16.1.6 & 16.1.7 • According to the order of layers • Mac -> IP -> upper layer

  5. Trace file (old) • Basic part ( format_mac() ) • %.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] • Tag (%c) • s : send • r : receive • d : drop • f : forward • Time (%.9f) • Time stamp

  6. Trace file (old) • Node ID (_%d_ or %d) • Without log_position => _%d_ • With log_position (for mobile case) => %d • Coordinate (%6.2f %6.2f) • X & Y • Level ( %3s) • MAC • RTR • AGT

  7. Trace file (old) • Why (%4s) • Reason for dropped packet • Event ID (%d) • Event identifier • Packet type (%s) • cbr or tcp • Packet size (%d) • [duration destination sender type] (%x) • Duration : expected time to send data • Destination & Sender : Mac address • Type : IP (0x0800) or ARP (0x0806)

  8. Trace file (old) • IP part • ------- [%d:%d %d:%d %d %d] • Source IP Address • Source Port Number • Destination IP Address • Destination Port Number • TTL Value • Next Hop Address, If Any

  9. Trace file (old) • Remaining parts are according to • level • protocol • For example : CBR trace [%d] %d %d s 0.001000000 _0_ AGT --- 0 cbr 210 [0 0 0 0] ------- [0:0 1:0 32 0] [0] 0 0 • Please read manual 16.1.6 or http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats#Old_Wireless_Trace_Formats

  10. Trace file(new) • $ns use-newtrace • Event type • s send • r receive • d drop • f forward • General tag • -t : time or *(global setting)

  11. Trace file(new) • Node property tags • -Ni: node id • -Nx: node’s x-coordinate • -Ny: node’s y-coordinate • -Nz: node’s z-coordinate • -Ne: node energy level • -Nl: trace level, such as AGT, RTR, MAC • -Nw: reason for the event • “End”、”COL”、”IFQ”

  12. Trace file(new) • Packet information at IP level • -Is: source address.source port number • -Id: dest address.dest port number • -It: packet type • -Il: packet size • -If: flow id • -Ii: unique id • -Iv: ttl value

  13. Trace file(new) • Next hop info • -Hs: id for this node • -Hd: id for next hop towards the destination • Packet info at MAC level • -Ma: duration • -Md: dst’s ethernet address • -Ms: src’s ethernet address • -Mt: ethernet type

  14. Trace file(new) • Packet info at "Application level“ • Example : -P cbr Constant bit rate • -Pi: sequence number • -Pf: how many times this pkt was forwarded • -Po: optimal number of forwards • Remaining parts, please read manual 16.1.7

  15. AWK • Once we can interpret the trace file, how do we obtain meaningful statistics ? • Some useful languages • awk、perl • Here we’ll introduce the awk language and you all need to write awk programs for experiment 1

  16. AWK • Like TCL, uses an Interpreter, rather than a compiler, to run the program • Typeless • Associative Array • Process Record、Field data very well • Pipe • Similar to C language

  17. AWK • Procedure • 1. read one row from data file • 2. store to each field (depart by “tab” or “space”) • 3. update variables • 4. run every Pattern { Action } • 5. if any data haven’t been read yet, repeat step 1~4 • Run • $ awk –f awkfilename.awkinputfile

  18. AWK • Pattern • expressions, operators • >、==、!=、 • ~(match)、!~(not match) • Action • I/O instructions : print、printf()、getline • Flow control:if 、for loop、while loop • Like what we learned in C language

  19. AWK • For example : (data.txt) A125 Jenny 100 210 A341 Dan 110 215 P158 Max 130 209 P148 John 125 220 A123 Linda 95 210 • countsalary.awk count = $3*$4 printf (“%d\n” ,count);

  20. AWK • first line • $0 = ‘A125 Jenny 100 210’ • $1 = A125 • $2 = Jenny • $3 = 100 • $4 = 210 • $ awk –f countsalary.awk data.txt 21000 23650 27170 27500 19950

  21. AWK • Control flows are the same as C language • For extra information, please browse http://phi.sinica.edu.tw/aspac/reports/94/94011/ http://www.study-area.org/cyril/scripts/scripts/node61.html

  22. Experiment-1 • Download Exp-1.ppt & Experiment-1.doc from our course website • Modify sample.tcl to meet the scenario we specified in the next slide • Run simulation and write an awk program to compute • average end-to-end delay • packet delivery ratio • throughput

  23. Experiment-1 • Network scenario • 2 nodes placed apart by 100 (meters) • Enable RTS/CTS four-way handshaking • Simulation time = 3 • Name the trace file & nam file as your student ID • Use new trace format • Turn mac & router trace OFF • Generate a CBR traffic without using a procedure • CBR packet size = 500 (bytes) • CBR rate = 500kb(ps) • CBR traffic start at 0.05 stop at 1.0

  24. Experiment-1 • #total packets received packet delivery ratio = ---------------------------- #total packets sent • end-to-end delay per packet : (received time – sent time) • total e2e delay average e2e delay = ------------------------------- #total packets ps. You don’t have to consider Dropped packets (w/ infinite delay)

  25. Experiment-1 • total received data size (bytes) x 8 (bits) throughput = --------------------------------------------------- simulation time (3.0 sec) • 1mbits = 1024 kbits , 1kbits = 1024 bits

  26. References • AWK • http://phi.sinica.edu.tw/aspac/reports/94/94011/ • http://www.study-area.org/cyril/scripts/scripts/node61.html • Ns2 official website • http://www.isi.edu/nsnam/ns/index.html • Ns2 wiki • http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats#Old_Wireless_Trace_Formats

  27. Thank You !!

More Related