| 1 |
# ------- Test XCP Performance over a a sequence of bottlenecks ---------------# |
| 2 |
# |
| 3 |
# Author: Dina Katabi <[email protected]> |
| 4 |
# Last Update : 09/09/2002 |
| 5 |
# |
| 6 |
# Descrp: parking lot topo |
| 7 |
# |
| 8 |
Agent/TCP set minrto_ 1 |
| 9 |
|
| 10 |
#-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Utility Functions -*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-# |
| 11 |
|
| 12 |
|
| 13 |
#--------------- CC Eprimental TOPOLOGY: Control Transfer -------------------------------# |
| 14 |
# - This topology is useful for experimenting with the behavior of a |
| 15 |
# connection when its bottleneck moves from one node to another |
| 16 |
# |
| 17 |
# n0 ------------ n1 .... n[numHops-1]------------n[numHops] |
| 18 |
# |
| 19 |
proc create-string-topology {numHops BW_list d_list qtype_list qsize_list } { |
| 20 |
global ns |
| 21 |
|
| 22 |
set numNodes [expr $numHops + 1 ] |
| 23 |
|
| 24 |
# first sanity check |
| 25 |
if { [llength $BW_list] != [llength $d_list] || [llength $qtype_list] != [llength $qsize_list]} { |
| 26 |
error "Args sizes don't match with $numHops hops" |
| 27 |
if { [llength $BW_list] != $numHops || $numHops != [llength $qsize_list]} { |
| 28 |
puts "error in using proc create-string-topology" |
| 29 |
error "Args sizes don't match with $numHops hops" |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
# compute the pipe assuming packet size is 1000 bytes, delays are in msec and BWs are in Mbits |
| 34 |
set forwarddelay 0; |
| 35 |
global minBW; |
| 36 |
set minBW [lindex $BW_list 0]; |
| 37 |
for { set i 0} { $i < $numHops } { incr i } { |
| 38 |
set forwarddelay [expr $forwarddelay + [lindex $d_list $i]] |
| 39 |
if {$minBW > [lindex $BW_list $i] } { set $minBW [lindex $BW_list $i] } |
| 40 |
} |
| 41 |
set pipe [expr round([expr $minBW /8 * $forwarddelay * 2])] |
| 42 |
|
| 43 |
for { set i 0} { $i < $numNodes } { incr i } { |
| 44 |
global n$i |
| 45 |
set n$i [$ns node] |
| 46 |
} |
| 47 |
|
| 48 |
for { set i 0} { $i < $numHops } { incr i } { |
| 49 |
set qsize [lindex $qsize_list $i] |
| 50 |
set bw [lindex $BW_list $i] |
| 51 |
set delay [lindex $d_list $i] |
| 52 |
set qtype [lindex $qtype_list $i] |
| 53 |
|
| 54 |
puts "$i bandwidth $bw" |
| 55 |
if {$qsize == 0} { set qsize $pipe} |
| 56 |
$ns duplex-link [set n$i] [set n[expr $i +1]] [set bw]Mb [set delay]ms $qtype |
| 57 |
$ns queue-limit [set n$i] [set n[expr $i + 1]] $qsize |
| 58 |
$ns queue-limit [set n[expr $i + 1]] [set n$i] $qsize |
| 59 |
# Give a global handle to the Queues to allow setting the RED paramters |
| 60 |
global q$i; set q$i [ [$ns link [set n$i] [set n[expr $i + 1]]] queue] |
| 61 |
global rq$i; set rq$i [ [$ns link [set n[expr $i + 1]] [set n$i]] queue] |
| 62 |
global l$i; set l$i [$ns link [set n$i] [set n[expr $i + 1]]] |
| 63 |
global rl$i; set rl$i [$ns link [set n[expr $i + 1]] [set n$i]] |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
proc set-red-params { qsize } { |
| 69 |
#Queue/RED set thresh_ [expr 0.6 * $qsize] |
| 70 |
#Queue/RED set maxthresh_ [expr 0.8 * $qsize] |
| 71 |
#Queue/RED set q_weight_ 0.001 |
| 72 |
Queue/RED set linterm_ 10 |
| 73 |
Queue/RED set bytes_ false ; |
| 74 |
Queue/RED set queue_in_bytes_ false ; |
| 75 |
Agent/TCP set old_ecn_ true |
| 76 |
Queue/RED set setbit_ true |
| 77 |
} |
| 78 |
|
| 79 |
proc flush-files { files } { |
| 80 |
foreach file $files { |
| 81 |
global "$file" |
| 82 |
if {[info exists $file]} { |
| 83 |
puts "flush $file" |
| 84 |
flush [set $file] |
| 85 |
close [set $file] |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
#------- Sender Class : |
| 91 |
# This is essentially an ftp sender |
| 92 |
Class GeneralSender -superclass Agent |
| 93 |
|
| 94 |
# otherparams are "startTime TCPclass .." |
| 95 |
GeneralSender instproc init { id node rcvrTCP otherparams } { |
| 96 |
global ns |
| 97 |
$self next |
| 98 |
$self instvar tcp_ id_ ftp_ node_ tcp_rcvr_ tcp_type_ |
| 99 |
set id_ $id |
| 100 |
set node_ $node |
| 101 |
|
| 102 |
if { [llength $otherparams] > 1 } { |
| 103 |
set TCP [lindex $otherparams 1] |
| 104 |
} else { |
| 105 |
set TCP "TCP/Reno" |
| 106 |
} |
| 107 |
set tcp_type_ $TCP |
| 108 |
set tcp_ [new Agent/$TCP] |
| 109 |
$tcp_ set packetSize_ 1000 |
| 110 |
$tcp_ set class_ $id |
| 111 |
set ftp_ [new Source/FTP] |
| 112 |
$ftp_ set agent_ $tcp_ |
| 113 |
$ns attach-agent $node $tcp_ |
| 114 |
$ns connect $tcp_ $rcvrTCP |
| 115 |
set tcp_rcvr_ $rcvrTCP |
| 116 |
set startTime [lindex $otherparams 0] |
| 117 |
$ns at $startTime "$ftp_ start" |
| 118 |
puts "initialized Sender $id_ at $startTime" |
| 119 |
} |
| 120 |
|
| 121 |
GeneralSender instproc trace-xcp parameters { |
| 122 |
$self instvar tcp_ id_ tcpTrace_ |
| 123 |
global ftracetcp$id_ |
| 124 |
set ftracetcp$id_ [open xcp$id_.tr w] |
| 125 |
set tcpTrace_ [set ftracetcp$id_] |
| 126 |
$tcp_ attach-trace [set ftracetcp$id_] |
| 127 |
if { -1 < [lsearch $parameters cwnd] } { $tcp_ tracevar cwnd_ } |
| 128 |
if { -1 < [lsearch $parameters seqno] } { $tcp_ tracevar t_seqno_ } |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
#--- Command line arguments |
| 134 |
proc set-cmd-line-args { list_args } { |
| 135 |
global argv |
| 136 |
|
| 137 |
set i 0 |
| 138 |
foreach a $list_args { |
| 139 |
global $a |
| 140 |
set $a [lindex $argv $i] |
| 141 |
puts "$a = [set $a]" |
| 142 |
incr i |
| 143 |
} |
| 144 |
} |
| 145 |
|
| 146 |
#-------------- Plotting functions -----------# |
| 147 |
|
| 148 |
# plot a xcp traced var |
| 149 |
proc plot-xcp { TraceName nXCPs PlotTime what } { |
| 150 |
exec rm -f xgraph.tcp |
| 151 |
set f [open xgraph.tcp w] |
| 152 |
puts $f "TitleText: $TraceName" |
| 153 |
puts $f "Device: Postscript" |
| 154 |
|
| 155 |
foreach i $nXCPs { |
| 156 |
#the TCP traces are flushed when the sources are stopped |
| 157 |
exec rm -f temp.tcp |
| 158 |
exec touch temp.tcp |
| 159 |
global ftracetcp$i |
| 160 |
if [info exists ftracetcp$i] { flush [set ftracetcp$i] } |
| 161 |
set result [exec awk -v PlotTime=$PlotTime -v what=$what { |
| 162 |
{ |
| 163 |
if (( $6 == what ) && ($1 > PlotTime)) { |
| 164 |
print $1, $7 >> "temp.tcp"; |
| 165 |
} |
| 166 |
} |
| 167 |
} xcp$i.tr] |
| 168 |
|
| 169 |
puts "$i : $result" |
| 170 |
|
| 171 |
puts $f \"$what$i |
| 172 |
exec cat temp.tcp >@ $f |
| 173 |
puts $f "\n" |
| 174 |
flush $f |
| 175 |
} |
| 176 |
close $f |
| 177 |
exec xgraph -nl -m -x time -y $what xgraph.tcp & |
| 178 |
return |
| 179 |
} |
| 180 |
|
| 181 |
# Takes as input the the label on the Y axis, the time it starts plotting, and the trace file tcl var |
| 182 |
proc plot-red-queue { TraceName PlotTime traceFile } { |
| 183 |
|
| 184 |
exec rm -f xgraph.red_queue |
| 185 |
exec rm -f temp.q temp.a temp.p temp.avg_enqueued temp.avg_dequeued temp.x temp.y |
| 186 |
exec touch temp.q temp.a temp.p temp.avg_enqueued temp.avg_dequeued temp.x temp.y |
| 187 |
|
| 188 |
exec awk -v PT=$PlotTime { |
| 189 |
{ |
| 190 |
if (($1 == "Q" && NF>2) && ($2 > PT)) { |
| 191 |
print $2, $3 >> "temp.q" |
| 192 |
} |
| 193 |
else if (($1 == "a" && NF>2) && ($2 > PT)){ |
| 194 |
print $2, $3 >> "temp.a" |
| 195 |
} |
| 196 |
else if (($1 == "p" && NF>2) && ($2 > PT)){ |
| 197 |
print $2, $3 >> "temp.p" |
| 198 |
} |
| 199 |
} |
| 200 |
} $traceFile |
| 201 |
|
| 202 |
set ff [open xgraph.red_queue w] |
| 203 |
puts $ff "TitleText: $TraceName" |
| 204 |
puts $ff "Device: Postscript \n" |
| 205 |
puts $ff \"queue |
| 206 |
exec cat temp.q >@ $ff |
| 207 |
puts $ff \n\"ave_queue |
| 208 |
exec cat temp.a >@ $ff |
| 209 |
puts $ff \n\"prob_drop |
| 210 |
exec cat temp.p >@ $ff |
| 211 |
|
| 212 |
close $ff |
| 213 |
exec xgraph -P -x time -y queue xgraph.red_queue & |
| 214 |
} |
| 215 |
|
| 216 |
#-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Initializing Simulator -*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-# |
| 217 |
# BW is in Mbs and delay is in ms |
| 218 |
|
| 219 |
set-cmd-line-args " numHops PostProcess seed qType BW nAllHopsTCPs delay" |
| 220 |
|
| 221 |
set numNodes [expr $numHops + 1 ] |
| 222 |
set ns [new Simulator] |
| 223 |
set rtg [new RNG] |
| 224 |
$rtg seed $seed |
| 225 |
|
| 226 |
|
| 227 |
#-----Global Variables-----------# |
| 228 |
#set qType Vq |
| 229 |
#set BW [expr 10.0 * 1] |
| 230 |
#set delay 50 |
| 231 |
|
| 232 |
|
| 233 |
set tracefd [open out.tr w] |
| 234 |
$ns trace-all $tracefd |
| 235 |
|
| 236 |
set qSize [expr round([expr ($BW / 8.0) * 2.0 * $delay * 10 ])] |
| 237 |
#set qSize [expr round([expr ($BW / 8.0) * $delay * 1000 ])] |
| 238 |
puts "queue is $qSize" |
| 239 |
set qEffective_RTT [expr 20 * $delay * 0.001] |
| 240 |
|
| 241 |
#set-red-params $qSize |
| 242 |
|
| 243 |
set BW2 [expr $BW / 2.0] |
| 244 |
puts "BW2 = $BW2" |
| 245 |
set BW_list {} |
| 246 |
set qType_list {} |
| 247 |
set delay_list {} |
| 248 |
set qSize_list {} |
| 249 |
set nTCPsPerHop_list {} |
| 250 |
set StartTime_list {} |
| 251 |
for {set i 0} {$i < $numHops} {incr i} { |
| 252 |
lappend BW_list $BW |
| 253 |
lappend qType_list $qType |
| 254 |
lappend delay_list $delay |
| 255 |
lappend qSize_list $qSize |
| 256 |
lappend nTCPsPerHop_list 30 |
| 257 |
lappend StartTime_list 0 |
| 258 |
} |
| 259 |
set tracedQueues "" |
| 260 |
set tracedXCPs "0 1 2 3 4 5 6 7 8" |
| 261 |
#set nAllHopsTCPs 30; #num of TCPs crossing all hops |
| 262 |
set rTCPs 30; #traverse all of the reverse path |
| 263 |
|
| 264 |
set SimStartTime 0.0 |
| 265 |
set SimStopTime 20 |
| 266 |
set PlotTime 0 |
| 267 |
|
| 268 |
#---------- Create the simulation --------------------# |
| 269 |
|
| 270 |
# Create topology |
| 271 |
create-string-topology $numHops $BW_list $delay_list $qType_list $qSize_list; #all except the first are lists |
| 272 |
|
| 273 |
set i 0; |
| 274 |
while { $i < $numHops } { |
| 275 |
set qtype [lindex $qType_list $i] |
| 276 |
set bw [lindex $BW_list $i] |
| 277 |
switch $qtype { |
| 278 |
"RED" { |
| 279 |
foreach queue "[set q$i] [set rq$i]" { |
| 280 |
set-red-params $queue $qMinTh $qMaxTh $qWeight $qLinterm |
| 281 |
} |
| 282 |
} |
| 283 |
"Vq" { |
| 284 |
foreach link "[set l$i] [set rl$i]" { |
| 285 |
set queue [$link queue] |
| 286 |
$queue set ecnlim_ 0.98 |
| 287 |
$queue set limit_ $qSize |
| 288 |
$queue link_capacity_bits [[$link set link_] set bandwidth_]; |
| 289 |
$queue set queue_in_bytes_ 1 |
| 290 |
$queue set buflim_ 1000 |
| 291 |
$queue set alpha_ 0.15 |
| 292 |
} |
| 293 |
} |
| 294 |
"REM" { |
| 295 |
foreach link "[set l$i] [set rl$i]" { |
| 296 |
set queue [$link queue] |
| 297 |
$queue set reminw_ 0.01 |
| 298 |
$queue set remgamma_ 0.001 |
| 299 |
$queue set remphi_ 1.001 |
| 300 |
set cap_in_bits [[$link set link_] set bandwidth_] |
| 301 |
$queue set remupdtime_ [expr 0.01 / ($cap_in_bits/8000000.0)] |
| 302 |
$queue set rempktsize_ 1000 |
| 303 |
$queue set rempbo_ [expr $qSize * 0.33] |
| 304 |
} |
| 305 |
} |
| 306 |
"DropTail" { } |
| 307 |
"XCP" { |
| 308 |
foreach link "[set l$i] [set rl$i]" { |
| 309 |
set queue [$link queue] |
| 310 |
#set-red-params $queue $qMinTh $qMaxTh $qWeight $qLinterm |
| 311 |
$queue set-link-capacity [[$link set link_] set bandwidth_]; |
| 312 |
} |
| 313 |
} |
| 314 |
"CSFQ" { |
| 315 |
foreach link "[set l$i]" { |
| 316 |
set queue [$link queue] |
| 317 |
set ff 0 |
| 318 |
while {$ff < $nAllHopsTCPs} { |
| 319 |
# Second argument is the flow's wait |
| 320 |
$queue init-flow $ff 1.0 [expr 1000 * $delay * 2 * 4] |
| 321 |
incr ff |
| 322 |
} |
| 323 |
set j [expr (1000 * $i) + 1000 ]; |
| 324 |
while { $j < [expr [lindex $nTCPsPerHop_list $i] + ($i + 1) * 1000] } { |
| 325 |
$queue init-flow $j 1.0 [expr 1000 * $delay * 2 * 4] |
| 326 |
incr j |
| 327 |
} |
| 328 |
set kLink [expr 1000 * $delay * 2 * 4] |
| 329 |
set queueSize [expr $qSize * 1000 * 8] |
| 330 |
set qsizeThresh [expr $queueSize * 0.4] |
| 331 |
$queue init-link 1 $kLink $queueSize $qsizeThresh [[$link set link_] set bandwidth_] |
| 332 |
} |
| 333 |
foreach link "[set rl$i]" { |
| 334 |
set queue [$link queue] |
| 335 |
set ff $nAllHopsTCPs |
| 336 |
while {$ff < [expr $rTCPs + $nAllHopsTCPs ] } { |
| 337 |
# Second argument is the flow's wait |
| 338 |
$queue init-flow $ff 1.0 [expr 1000 * $delay * 2 * 4] |
| 339 |
incr ff |
| 340 |
} |
| 341 |
set kLink [expr 1000 * $delay * 2 * 4] |
| 342 |
set queueSize [expr $qSize * 1000 * 8] |
| 343 |
set qsizeThresh [expr $queueSize * 0.7] |
| 344 |
$queue init-link 1 $kLink $queueSize $qsizeThresh [[$link set link_] set bandwidth_] |
| 345 |
} |
| 346 |
|
| 347 |
} |
| 348 |
default {} |
| 349 |
} |
| 350 |
incr i |
| 351 |
} |
| 352 |
|
| 353 |
# Create sources: 1) Long TCPs |
| 354 |
set i 0 |
| 355 |
while { $i < $nAllHopsTCPs } { |
| 356 |
set StartTime [expr [$rtg integer 1000] * 0.001 * (0.01 * $numHops * $delay) + $SimStartTime] |
| 357 |
if {$qType == "XCP" } { |
| 358 |
set rcvr_TCP [new Agent/TCPSink/XCPSink] |
| 359 |
$ns attach-agent [set n$numHops] $rcvr_TCP |
| 360 |
set src$i [new GeneralSender $i $n0 $rcvr_TCP "$StartTime TCP/Reno/XCP"] |
| 361 |
puts "starttime=$StartTime" |
| 362 |
} else { |
| 363 |
set rcvr_TCP [new Agent/TCPSink] |
| 364 |
$ns attach-agent [set n$numHops] $rcvr_TCP |
| 365 |
set src$i [new GeneralSender $i $n0 $rcvr_TCP "$StartTime TCP/Reno"] |
| 366 |
} |
| 367 |
[[set src$i] set tcp_] set window_ [expr $qSize * 10] |
| 368 |
incr i |
| 369 |
} |
| 370 |
|
| 371 |
# 2) jth Hop TCPs; start at j*1000 |
| 372 |
set i 0; |
| 373 |
while {$i < $numHops} { |
| 374 |
set j [expr (1000 * $i) + 1000 ]; |
| 375 |
while { $j < [expr [lindex $nTCPsPerHop_list $i] + ($i + 1) * 1000] } { |
| 376 |
set StartTime [expr [lindex $StartTime_list $i]+[$rtg integer 1000] * 0.001 * (0.01 * $numHops * $delay)+ $SimStartTime] |
| 377 |
if {$qType == "XCP" } { |
| 378 |
set rcvr_TCP [new Agent/TCPSink/XCPSink] |
| 379 |
$ns attach-agent [set n[expr $i + 1]] $rcvr_TCP |
| 380 |
set src$j [new GeneralSender $j [set n$i] $rcvr_TCP "$StartTime TCP/Reno/XCP"] |
| 381 |
puts "starttime=$StartTime" |
| 382 |
} else { |
| 383 |
set rcvr_TCP [new Agent/TCPSink] |
| 384 |
$ns attach-agent [set n[expr $i + 1]] $rcvr_TCP |
| 385 |
set src$j [new GeneralSender $j [set n$i] $rcvr_TCP "$StartTime TCP/Reno"] |
| 386 |
} |
| 387 |
[[set src$j] set tcp_] set window_ [expr $qSize * 10] |
| 388 |
incr j |
| 389 |
} |
| 390 |
incr i |
| 391 |
} |
| 392 |
|
| 393 |
# 3) reverse TCP; ids follow directly allhops TCPs |
| 394 |
|
| 395 |
|
| 396 |
set i 0 |
| 397 |
while {$i < $numHops} { |
| 398 |
set l 0 |
| 399 |
while { $l < $rTCPs} { |
| 400 |
set s [expr $l + $nAllHopsTCPs + ( $i * $rTCPs ) ] |
| 401 |
#puts "s=$s rTCPs=$rTCPs l=$l All=$nAllHopsTCPs" |
| 402 |
set StartTime [expr [$rtg integer 1000] * 0.001 * (0.01 * $numHops * $delay)+ 0.0] |
| 403 |
if {$qType == "XCP" } { |
| 404 |
set rcvr_TCP [new Agent/TCPSink/XCPSink] |
| 405 |
$ns attach-agent [set n$i] $rcvr_TCP |
| 406 |
set src$s [new GeneralSender $s [set n[expr $i + 1]] $rcvr_TCP "$StartTime TCP/Reno/XCP"] |
| 407 |
puts "starttime=$StartTime" |
| 408 |
} else { |
| 409 |
set rcvr_TCP [new Agent/TCPSink] |
| 410 |
$ns attach-agent [set n$i] $rcvr_TCP |
| 411 |
set src$s [new GeneralSender $s [set n[expr $i + 1]] $rcvr_TCP "$StartTime TCP/Reno"] |
| 412 |
} |
| 413 |
[[set src$s] set tcp_] set window_ [expr $qSize * 10] |
| 414 |
incr l |
| 415 |
} |
| 416 |
incr i |
| 417 |
} |
| 418 |
|
| 419 |
#---------- Trace --------------------# |
| 420 |
# General |
| 421 |
#set f_all [open TR/out.tr w] |
| 422 |
#$ns trace-queue $n0 $n1 $f_all |
| 423 |
#$ns trace-queue $n1 $n2 $f_all |
| 424 |
#$ns trace-queue $n2 $n3 $f_all |
| 425 |
#$ns trace-queue $n3 $n4 $f_all |
| 426 |
#$ns trace-queue $n4 $n5 $f_all |
| 427 |
#$ns trace-queue $n5 $n6 $f_all |
| 428 |
#$ns trace-queue $n6 $n7 $f_all |
| 429 |
#$ns trace-queue $n7 $n8 $f_all |
| 430 |
#$ns trace-queue $n8 $n9 $f_all |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
# Trace sources |
| 435 |
foreach i $tracedXCPs { |
| 436 |
[set src$i] trace-xcp "cwnd seqno" |
| 437 |
} |
| 438 |
|
| 439 |
# Trace Queues |
| 440 |
set i 0; |
| 441 |
while { $i < $numHops } { |
| 442 |
set qtype [lindex $qType_list $i] |
| 443 |
foreach queue_name "q$i rq$i" { |
| 444 |
set queue [set "$queue_name"] |
| 445 |
switch $qtype { |
| 446 |
"DropTail" {} |
| 447 |
"Vq" {} |
| 448 |
"REM" {} |
| 449 |
"CSFQ" {} |
| 450 |
#"RED/XCP" {} |
| 451 |
default { #RED and XCP |
| 452 |
global "ft_red_$queue_name" |
| 453 |
set "ft_red_$queue_name" [open TR/ft_red_[set queue_name].tr w] |
| 454 |
$queue attach [set ft_red_$queue_name] |
| 455 |
#$queue trace curq_ |
| 456 |
#$queue trace ave_ |
| 457 |
#$queue trace prob1_ |
| 458 |
} |
| 459 |
} |
| 460 |
} |
| 461 |
|
| 462 |
#The following is done in the Queue Class |
| 463 |
foreach queue_name "q$i" { |
| 464 |
puts "attaching a file to $queue_name $qType" |
| 465 |
set queue [set "$queue_name"] |
| 466 |
$queue queue-sample-everyrtt $qEffective_RTT |
| 467 |
#global ft_trace_$queue_name |
| 468 |
#set ft_trace_$queue_name [open TR/ft_trace_[set queue_name].tr w] |
| 469 |
#$queue queue-attach [set ft_trace_$queue_name] |
| 470 |
#$queue queue-trace-drops |
| 471 |
#$queue queue-trace-curq |
| 472 |
} |
| 473 |
### Trace Utilization |
| 474 |
#[set q$i] queue-set-link-capacity [[[$ns link [set n$i] [set n[expr $i +1]]] set link_] set bandwidth_] |
| 475 |
incr i |
| 476 |
} |
| 477 |
#---------------- Run the simulation ------------------------# |
| 478 |
|
| 479 |
set files "f_all ";set i 0; |
| 480 |
while { $i < $numHops } { |
| 481 |
set files "$files ft_trace_q$i ft_trace_rq$i ft_q$i ft_rq$i ft_red_q$i ft_red_rq$i " |
| 482 |
incr i |
| 483 |
} |
| 484 |
|
| 485 |
foreach i $tracedXCPs { |
| 486 |
set file [set src$i tcpTrace_] |
| 487 |
set files "$files $file" |
| 488 |
} |
| 489 |
|
| 490 |
proc finish {} { |
| 491 |
global ns |
| 492 |
if {[info exists f]} { |
| 493 |
$ns flush-trace |
| 494 |
close $f |
| 495 |
} |
| 496 |
$ns halt |
| 497 |
} |
| 498 |
|
| 499 |
$ns at $SimStopTime "finish" |
| 500 |
$ns run |
| 501 |
flush-files $files |
| 502 |
#----------------- Post Processing---------------------------# |
| 503 |
|
| 504 |
if { $PostProcess } { |
| 505 |
#--- Traced Flows |
| 506 |
set TraceName "Flows --$qType-QS$qSize" |
| 507 |
plot-xcp $TraceName $tracedXCPs 0.0 "cwnd_" |
| 508 |
plot-xcp $TraceName $tracedXCPs 0.0 "t_seqno_" |
| 509 |
} |
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
if { $PostProcess } { |
| 514 |
#---- Queue 1 - Data |
| 515 |
set i 0; |
| 516 |
foreach i $tracedQueues { |
| 517 |
puts "Q$i" |
| 518 |
set TraceName "q$i--QS$qSize-Max$qMaxTh-Min$qMinTh" |
| 519 |
switch $qType { |
| 520 |
"DropTail" {} |
| 521 |
"Vq" { |
| 522 |
#plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "vq_len" |
| 523 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "virtual_cap" |
| 524 |
} |
| 525 |
"XCP" { |
| 526 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "input_traffic_bytes_ BTA_ BTF_" |
| 527 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "BTA_not_allocated BTF_not_reclaimed" |
| 528 |
plot-red-queue1 $TraceName 0 TR/ft_red_q$i.tr |
| 529 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "Queue_bytes_" |
| 530 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "avg_rtt_ Tq_" |
| 531 |
} |
| 532 |
"RED" { |
| 533 |
plot-red-queue1 $TraceName 0 TR/ft_red_q$i.tr |
| 534 |
} |
| 535 |
"CSFQ" { |
| 536 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "rateAlpha_ rateTotal_" |
| 537 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "congested_" |
| 538 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "alpha_" |
| 539 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "qsizeCrt_" |
| 540 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "label" |
| 541 |
} |
| 542 |
default {} |
| 543 |
} |
| 544 |
queue-plot $TraceName 0 [set ft_trace_q$i] TR/ft_trace_q$i.tr |
| 545 |
plot-function-of-time $TraceName 0 TR/ft_trace_q$i.tr "u" |
| 546 |
incr i |
| 547 |
} |
| 548 |
} |
| 549 |
|
| 550 |
set i 0 |
| 551 |
while { $i < $numHops} { |
| 552 |
puts " q$i drops = [[set q$i] queue-read-drops]" |
| 553 |
puts " r$i drops = [[set rq$i] queue-read-drops]" |
| 554 |
incr i |
| 555 |
} |