3 analysis(easier awk)

Upload: dilip-gyawali

Post on 03-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 3 Analysis(Easier Awk)

    1/36

  • 8/12/2019 3 Analysis(Easier Awk)

    2/36

    #utline

    A Simulation and its results The Format of Trace File The AWK language

    Result Analysis End-to-End Delay Jitter

    Pacet !oss

    Figure "ut#ut $%lot

    '

  • 8/12/2019 3 Analysis(Easier Awk)

    3/36

    " Simulation$ %CP and U&P

    s'

    s1

    r d

    tc#

    ud#

    ft#

    c(r

    )

    sin

    null

    T*P and &DP +ueuing

    ,1 s . /0 s

    1 s . /, s

  • 8/12/2019 3 Analysis(Easier Awk)

    4/36

    %he #%cl Script

    set s1 [$ns node]set s2 [$ns node]set r [$ns node]set d [$ns node]

    $ns duplex-link $s1 $r 2Mb 10ms DropTail

    $ns duplex-link $s2 $r 2Mb 10ms DropTail$ns duplex-link $r $d 1.7Mb 20ms DropTail

    $ns queue-limit $r $d 10

    $ns duplex-link-op $s1 $r orient right-down

    $ns duplex-link-op $s2 $r orient right-up$ns duplex-link-op $r $d orient right

    $ns duplex-link-op $r $d queuePos 0.5

    /

  • 8/12/2019 3 Analysis(Easier Awk)

    5/36

    %he #%cl Script

    set tcp [new Agent/TCP]$ns attach-agent $s1 $tcpset sink [new Agent/TCPSink]$ns attach-agent $d $sink$ns connect $tcp $sink

    $tcp set fid_ 1

    set ftp [new Application/FTP]$ftp attach-agent $tcp$ftp set type_ FTP

    0

  • 8/12/2019 3 Analysis(Easier Awk)

    6/36

    %he #%cl Script

    set udp [new Agent/UDP]$ns attach-agent $s2 $udpset null [new Agent/Null]$ns attach-agent $d $null$ns connect $udp $null

    $udp set fid_ 2

    set cbr [new Application/Traffic/CBR]$cbr attach-agent $udp$cbr set type_ CBR

    $cbr set packet_size_ 1000$cbr set rate_ 1mb$cbr set random_ false

  • 8/12/2019 3 Analysis(Easier Awk)

    7/36

    %he #%cl Script

    $ns at 0.1 "$cbr start"$ns at 1.0 "$ftp start"$ns at 4.0 "$ftp stop"$ns at 4.5 "$cbr stop"

    $ns at 4.5 "$ns detach-agent $s1 $tcp; $ns detach-agent $d

    $sink"

    $ns at 5.0 "finish"

    2

  • 8/12/2019 3 Analysis(Easier Awk)

    8/36

    N"M !esult

    3

  • 8/12/2019 3 Analysis(Easier Awk)

    9/36

    %race 'ile

    + 0.1 1 2 cbr 1000 ------- 2 1.0 3.1 0 0- 0.1 1 2 cbr 1000 ------- 2 1.0 3.1 0 0+ 0.108 1 2 cbr 1000 ------- 2 1.0 3.1 1 1- 0.108 1 2 cbr 1000 ------- 2 1.0 3.1 1 1r 0.114 1 2 cbr 1000 ------- 2 1.0 3.1 0 0+ 0.114 2 3 cbr 1000 ------- 2 1.0 3.1 0 0

    - 0.114 2 3 cbr 1000 ------- 2 1.0 3.1 0 0+ 0.116 1 2 cbr 1000 ------- 2 1.0 3.1 2 2- 0.116 1 2 cbr 1000 ------- 2 1.0 3.1 2 2r 0.122 1 2 cbr 1000 ------- 2 1.0 3.1 1 1+ 0.122 2 3 cbr 1000 ------- 2 1.0 3.1 1 1- 0.122 2 3 cbr 1000 ------- 2 1.0 3.1 1 1

    + 0.124 1 2 cbr 1000 ------- 2 1.0 3.1 3 3- 0.124 1 2 cbr 1000 ------- 2 1.0 3.1 3 3r 0.13 1 2 cbr 1000 ------- 2 1.0 3.1 2 2+ 0.13 2 3 cbr 1000 ------- 2 1.0 3.1 2 2- 0.13 2 3 cbr 1000 ------- 2 1.0 3.1 2 2+ 0.132 1 2 cbr 1000 ------- 2 1.0 3.1 4 4

    ... 4

  • 8/12/2019 3 Analysis(Easier Awk)

    10/36

    %race 'ormat

    ++0.10.11122cbrcbr10001000--------------221.01.03.13.10000

    EventEventTimeTime

    From nodeFrom nodeTo nodeTo nodePacket TypePacket TypePacket SizePacket SizeFlagsFlags

    Flow IDFlow IDSource addressSource addressDestination addressDestination addressSequence numberSequence numberPacket IDPacket ID

    r: receiver: receive+: enqueue+: enqueue

    -: dequeue-: dequeued: dropd: drop

    src_node.portsrc_node.portdest_node.portdest_node.port

    1,

  • 8/12/2019 3 Analysis(Easier Awk)

    11/36

    "() *anguage

    Designed for te5t analysis Similar to * (ut more sim#le Read the records line (y line

    6,7 the 8hole string in the corres#onding line

    617 the first data in the corres#onding line

    6'7 the second data in the corres#onding line

    ++0.10.11122cbrcbr10001000--------------221.01.03.13.10000

    61 6' 6) 6/ 60 6 62 63 64 61, 611 61'

    11

  • 8/12/2019 3 Analysis(Easier Awk)

    12/36

    "() *anguage +Cont,

    Three #arts in the AWK code 9E$:%

    Process

    E%D Process Procedure

    1;Read one record

    ';date the #arameters

    );Run the Pattern *ode

    /;Re#eat until no record remain

    1'

  • 8/12/2019 3 Analysis(Easier Awk)

    13/36

    "n "() Eample

    AWK *ode7 a8a8 file

    9E$:%< sum=,>?

    < if@61==B; < sumBB>

    ??

    E%D< #rintf@The num(er of enCueue is7 dnsum;>?

    1)

  • 8/12/2019 3 Analysis(Easier Awk)

    14/36

    "n "() Eample +Cont,

    &se the a8a8 to anlyGe the outtr trace file.6 a8 -f a8a8 outtr

    "ut#ut the results into sumt5t.6 a8 -f a8a8 outtr H sumt5t

    1/

  • 8/12/2019 3 Analysis(Easier Awk)

    15/36

    "nalysis .$ End-to-End &elay

    *alculate the duration of a #acet

    :n this e5am#le 8e calculate the end-to-enddelay for the c(r traffic Iia ud# transmission

    s'

    r d

    Start Time

    End Time

    End to End Delay = End Time Start Time

    10

  • 8/12/2019 3 Analysis(Easier Awk)

    16/36

    "nalysis .$ End-to-End &elay+Cont,

    9E$:% < highest#acetid=,> ?< action = 61> time = 6'> from = 6)> to = 6/> ty#e = 60> #tsiGe = 6> flo8id = 63> src = 64> dst = 61,> seCno = 611> #acetid = 61'> if @ #acetid H highest#acetid ; highest#acetid = #acetid> if @ starttimeL#acetidM == , ;

    starttimeL#acetidM = time> if @ flo8id == ' NN action O= d ; < if@ action == r ; < endtimeL#acetidM = time> ? else < endtimeL#acetidM = -1> ?

    ?? 1

  • 8/12/2019 3 Analysis(Easier Awk)

    17/36

    "nalysis .$ End-to-End &elay+Cont,

    E%D #acetid highest#acetid> #acetidBB; < start = starttimeL#acetidM> end = endtimeL#acetidM> #acetduration = end-start> if@ start end ; < #rintf@f fnstart #acetduration;> ? ??

    12

  • 8/12/2019 3 Analysis(Easier Awk)

    18/36

    "nalysis .$ End-to-End &elay+Cont,

    .6 a8 -f delaya8 outtr H delayt5t

    delayt5t7,1,,,,, ,,)32,

    ,1,3,,, ,,)32,

    ,11,,, ,,)32,

    ,1'/,,, ,,)32,

    ,1)',,, ,,)32,

    ,1/,,,, ,,)32,

    ,1/3,,, ,,)32,

    ,10,,, ,,)32, 13

  • 8/12/2019 3 Analysis(Easier Awk)

    19/36

    "nalysis 2$ /itter

    Jitter re#resents the Iariance of delay

    Jitter = @ @EndTime@;-StartTime@;; - @EndTime@i;-StartTime@i;; ; @ i;

    :n this e5am#le 8e calculate the itter for thec(r traffic Iia ud# transmission

    14

  • 8/12/2019 3 Analysis(Easier Awk)

    20/36

    "nalysis 2$ /itter+Cont,

    9E$:% < highest#acetid=,> ?

    time = 6'> from = 6)> to = 6/> ty#e = 60> #tsiGe = 6>

    flo8id = 63> src = 64> dst = 61,> seCno = 611> #acetid = 61'> if @ #acetid H highest#acetid ; highest#acetid = #acetid>

    if @ starttimeL#acetidM == , ; < #tseCnoL#acetidM = seCno> starttimeL#acetidM = time> ? if @ flo8id == ' NN action O= d ; < if@ action == r ; < endtimeL#acetidM = time> ? else < endtimeL#acetidM = -1> ? ?

    ? ',

  • 8/12/2019 3 Analysis(Easier Awk)

    21/36

    "nalysis 2$ /itter+Cont,E%D < lastseCuno = ,>

    lastdelay = ,> seCnodiff = ,> for@#acetid=,> #acetid highest#acetid> #acetidBB; < start = starttimeL#acetidM> end = endtimeL#acetidM> #acetduration = end-start>

    if@ start end ; < seCnodiff = #tseCnoL#acetidM-lastseCno> delaydiff = #acetduration - lastdelay>

    if @ seCnodiff == , ; < itter = ,> ? else < itter = delaydiffseCnodiff> ?

    #rintf@f fnstart itter;> lastseCno = #tseCnoL#acetidM> lastdelay = #acetduration> ? ?? '1

  • 8/12/2019 3 Analysis(Easier Awk)

    22/36

    "nalysis 2$ /itter+Cont,

    .6 a8 ittera8 outtr H ittert5t

    ,1,,,,, ,,,,,,,

    ,1,3,,, ,,,,,,,

    ,11,,, ,,,,,,,

    ,1'/,,, -,,,,,,,

    ,1)',,, ,,,,,,,

    ,1/,,,, ,,,,,,,

    ,1/3,,, ,,,,,,,

    ,10,,, -,,,,,,,

    Q ''

  • 8/12/2019 3 Analysis(Easier Awk)

    23/36

    "nalysis 3$ Pac0et *oss

    :n the transmission some of the #acets may(e lost due to the oIerflo8 of the Cueue

    !oss = PacetsSent - PacetsRecieIe

    :n this e5am#le 8e calculate the #acet loss forthe c(r traffic Iia ud# transmission

    s'

    r d

    Start Time

    End Time

    ')

    l i 0 + ,

  • 8/12/2019 3 Analysis(Easier Awk)

    24/36

    "nalysis 3$ Pac0et *oss+Cont,

    9E$:% < fsDro#s = ,> numFs = ,> ?< action = 61> time = 6'> from = 6)> to = 6/> ty#e = 60>

    #tsiGe = 6> flo8id = 63> src = 64> dst = 61,> seCno = 611> #acetid = 61'> if @ from == 1 NN to == ' NN action == B ;

    < numFsBB> ? if @ flo8id == ' NN action == d ; < fsDro#sBB> ??E%D?

    '/

    P i . %h h

  • 8/12/2019 3 Analysis(Easier Awk)

    25/36

    Practice .$ %hroughput

    To calculate the aIerage through#ut of the c(rtraffic (et8een node ' and node )

    AIerage Through#ut = Total RecieIed 9ytes Ela#sed Time

    "nce node ) recieIe a #acet #rint out thereal-time though#ut

    '0

    'i # t t

  • 8/12/2019 3 Analysis(Easier Awk)

    26/36

    'igure #utput

    A #icture #aints a thousand 8ords :n a #a#er figures@#lots; are al8ays the

    essential #arts of the simulation and analysissection

    Tools for figure dra8ing atla(

    athematica

    $%lot

    '

    1NU l t

  • 8/12/2019 3 Analysis(Easier Awk)

    27/36

    1NUplot

    Porta(le command-line driIen gra#hing utility Su##ort !inu5 Windo8s ac "S :t allo8s scientists and students to IisualiGe

    mathematical functions and data Su##orts many ty#es of #lots in either 'D and

    )D htt#7888gnu#lotinfo :nstallation in &(untu from source

    sudo a#t-get install gnu#lot

    '2

    t d fi

    http://www.gnuplot.info/http://www.gnuplot.info/
  • 8/12/2019 3 Analysis(Easier Awk)

    28/36

    o to dra a figure

    Enter the $%lot model

    Dra8 a #lot

    .6 gnu#lot

    gnu#lot H #lot Udelayt5tU

    To denote thegnu#lot model

    To denote thegnu#lot model

    The command fordra8ing

    The command fordra8ing The file name

    The file name

    '3

    ! lt f th 1NU l t

  • 8/12/2019 3 Analysis(Easier Awk)

    29/36

    !esult from the 1NUplot

    '4

    Commands in 1NUplot +.,

  • 8/12/2019 3 Analysis(Easier Awk)

    30/36

    Commands in 1NUplot +.,

    Set A5is Range

    Ste#

    E5am#le For 5 a5is

    Sho8ing range

    gnu#lot H set 5tics -1,11,gnu#lot H #lot sin@5;

    gnu#lot H set yrange L-'7'Mgnu#lot H #lot sin@5;

    VV

    ),

    Commands in 1NUplot +2,

  • 8/12/2019 3 Analysis(Easier Awk)

    31/36

    Commands in 1NUplot +2,

    Sho8 gridgnu#lot H set gridgnu#lot H #lot sin@5;

    )1

    Commands in 1NUplot +3,

  • 8/12/2019 3 Analysis(Easier Awk)

    32/36

    Commands in 1NUplot +3,

    !a(els

    gnu#lot H set title U*9R DelayUgnu#lot H set 5la(el USimulation Time @s;Ugnu#lot H set yla(el UDelay @s;Ugnu#lot H unset eygnu#lot H set la(el Uconstant delay = ,)32, secU at ,1,,0gnu#lot H set arro8 from ,0,,0 to ,0,,/

    gnu#lot H #lot Udelayt5tU 8ith lines#oints

    yla(elyla(el

    5la(el5la(el

    titletitle

    la(ella(el

    arro8arro8

    )'

    Commands in 1NUplot +4,

  • 8/12/2019 3 Analysis(Easier Awk)

    33/36

    Commands in 1NUplot +4,

    Styles lines

    #oints

    lines#oints

    im#ulses

    dots

    ste#s

    error(ars

    #oints im#ulses

    lines ste#s

    ))

    Command in 1NUplot +5,

  • 8/12/2019 3 Analysis(Easier Awk)

    34/36

    Command in 1NUplot +5,

    "ut#ut

    set the #icture formatgnu#lot H set terminal #ngset the out#ut file namegnu#lot H set out#ut Udelay#ngU

    dra8 the #lotgnu#lot H #lot Udelayt5tU 8ith lines#oints

    )/

    1P* script

  • 8/12/2019 3 Analysis(Easier Awk)

    35/36

    1P* script

    :t is inconIenient to in#ut commands Ty#os mae errors

    We may redra8 the #lot for many times

    Solution Write the $P! scri#t as g#l file

    Run the scri#t in the terminal

    .6 gnu#lot -#ersist delayg#l

    set title *9R Delayset 5la(el Simulation Time @s;set yla(el Delay @s;unset eyset la(el constant delay = ,)32, sec at ,1,,0set arro8 from ,0,,0 to ,0,,/set terminal #ngset out#ut c(rdelay#ng#lot delayt5t 8ith lines#oints

    )0

    6uestions7

  • 8/12/2019 3 Analysis(Easier Awk)

    36/36

    6uestions7

    Than you O