⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test-suite-cbq.tcl

📁 柯老师网站上找到的
💻 TCL
📖 第 1 页 / 共 3 页
字号:
        $ns_ at 24.0 "$cbr1 start"}## Create two CBR connections.#TestSuite instproc two_cbrs { ps1 ps2 int1 int2 dostop } {	$self instvar ns_ node_	set udp1 [$ns_ create-connection UDP $node_(s1) LossMonitor $node_(r2) 1]	set cbr1 [new Application/Traffic/CBR]	$cbr1 attach-agent $udp1	$cbr1 set packetSize_ $ps1 	$cbr1 set rate_ [expr $ps1 * 8/ [$ns_ delay_parse $int1]]	set udp2 [$ns_ create-connection UDP $node_(s2) LossMonitor $node_(r2) 2]	set cbr2 [new Application/Traffic/CBR]	$cbr2 attach-agent $udp2	$cbr2 set packetSize_ $ps2 	$cbr2 set rate_ [expr $ps2 * 8/ [$ns_ delay_parse $int2]]	$ns_ at 0.0 "$cbr1 start; $cbr2 start"	if { $dostop } {		$ns_ at 0.002 "$cbr1 stop"		$ns_ at 1.0 "$cbr1 start"		$ns_ at 1.08 "$cbr1 stop"	}}TestSuite instproc four_cbrs {} {	$self instvar ns_ node_	set udp1 [$ns_ create-connection UDP $node_(s1) LossMonitor $node_(r2) 1]	set cbr1 [new Application/Traffic/CBR]	$cbr1 attach-agent $udp1	$cbr1 set packetSize_ 190	$cbr1 set rate_ 1.52Mb; # interval of 0.001	set udp2 [$ns_ create-connection UDP $node_(s2) LossMonitor $node_(r2) 2]	set cbr2 [new Application/Traffic/CBR]	$cbr2 attach-agent $udp2	$cbr2 set packetSize_ 1000 	$cbr2 set rate_ 1.6Mb; # interval of 0.005	set udp3 [$ns_ create-connection UDP $node_(s3) LossMonitor $node_(r2) 3]	set cbr3 [new Application/Traffic/CBR]	$cbr3 attach-agent $udp3	$cbr3 set packetSize_ 500	$cbr3 set rate_ 2Mb; # interval of 0.002	set udp4 [$ns_ create-connection UDP $node_(s3) LossMonitor $node_(r2) 4]	set cbr4 [new Application/Traffic/CBR]	$cbr4 attach-agent $udp4	$cbr4 set packetSize_ 1000 	$cbr4 set rate_ 1.6Mb; # interval of 0.005	$ns_ at 0.0 "$cbr1 start; $cbr2 start; $cbr3 start; $cbr4 start"	$ns_ at 12.0 "$cbr1 stop"	$ns_ at 16.0 "$cbr1 start"	$ns_ at 36.0 "$cbr1 stop"	$ns_ at 20.0 "$cbr2 stop"	$ns_ at 24.0 "$cbr2 start"	$ns_ at 4.0 "$cbr3 stop"	$ns_ at 8.0 "$cbr3 start"	$ns_ at 36.0 "$cbr3 stop"	$ns_ at 28.0 "$cbr4 stop"	$ns_ at 32.0 "$cbr4 start"}TestSuite instproc four_tcps {} {	$self instvar ns_ node_	set tcp1 [$ns_ create-connection TCP $node_(s1) TCPSink $node_(r2) 1]	set ftp1 [$tcp1 attach-app FTP]	$tcp1 set packetSize_ 190	set tcp2 [$ns_ create-connection TCP $node_(s2) TCPSink $node_(r2) 2]	set ftp2 [$tcp2 attach-app FTP]	$tcp2 set packetSize_ 1000 	set tcp3 [$ns_ create-connection TCP $node_(s3) TCPSink $node_(r2) 3]	set ftp3 [$tcp3 attach-app FTP]	$tcp3 set packetSize_ 500	set tcp4 [$ns_ create-connection TCP $node_(s3) TCPSink $node_(r2) 4]	set ftp4 [$tcp4 attach-app FTP]	$tcp4 set packetSize_ 1000 	$ns_ at 0.0 "$ftp1 start; $ftp2 start; $ftp3 start; $ftp4 start"	$ns_ at 12.0 "$ftp1 stop"	$ns_ at 16.0 "$ftp1 start"	$ns_ at 36.0 "$ftp1 stop"	$ns_ at 20.0 "$ftp2 stop"	$ns_ at 24.0 "$ftp2 start"	$ns_ at 4.0 "$ftp3 stop"	$ns_ at 8.0 "$ftp3 start"	$ns_ at 36.0 "$ftp3 stop"	$ns_ at 28.0 "$ftp4 stop"	$ns_ at 32.0 "$ftp4 start"}## Figure 10 from the link-sharing paper. # ~/newr/rm/testB.com# Class Test/WRR -superclass TestSuiteTest/WRR instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-wrr	set test_ CBQ_WRR	$self next 0}Test/WRR instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set cbqalgorithm_ top-level	set stopTime 28.1	set maxbytes 187500	$topo_ instvar cbqlink_	$self create_flat true 0	$self insert_flat $cbqlink_	$self three_cbrs	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_WRR	$ns_ run}Class Test/PRR -superclass TestSuiteTest/PRR instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-prr	set test_ CBQ_PRR	$self next 0}## Figure 10, but packet-by-packet RR, and Formal.# Test/PRR instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set cbqalgorithm_ formal	set stopTime 28.1	set maxbytes 187500	$topo_ instvar cbqlink_	$self create_flat true 0	$self insert_flat $cbqlink_	$self three_cbrs	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_PRR	$ns_ run}# Figure 12 from the link-sharing paper.# WRR, Ancestor-Only link-sharing.# ~/newr/rm/testA.com# Class Test/AO -superclass TestSuiteTest/AO instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-wrr	set test_ CBQ_AO	$self next 0}Test/AO instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set stopTime 40.1	set maxbytes 187500	set cbqalgorithm_ ancestor-only	$topo_ instvar cbqlink_	$self create_twoagency	$self insert_twoagency $cbqlink_	$self four_cbrs	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_AO	$ns_ run}## Figure 13 from the link-sharing paper.# WRR, Top link-sharing.# ~/newr/rm/testA.com#Class Test/TL -superclass TestSuiteTest/TL instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-wrr	set test_ CBQ_TL	$self next 0}Test/TL instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set stopTime 40.1	set maxbytes 187500	set cbqalgorithm_ top-level	$topo_ instvar cbqlink_	$self create_twoagency	$self insert_twoagency $cbqlink_	$self four_cbrs	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_TL	$ns_ run}## Figure 11 from the link-sharing paper.# WRR, Formal (new) link-sharing.# ~/newr/rm/testA.com#Class Test/FORMAL -superclass TestSuiteTest/FORMAL instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-wrr	set test_ CBQ_FORMAL	$self next 0}Test/FORMAL instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set stopTime 40.1	set maxbytes 187500	set cbqalgorithm_ formal	$topo_ instvar cbqlink_	$self create_twoagency	$self insert_twoagency $cbqlink_	$self four_cbrs	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_FORMAL	$ns_ run}## WRR, Formal link-sharing, with TCP instead of UDP traffic.#Class Test/FORMAL_TCP -superclass TestSuiteTest/FORMAL_TCP instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-wrr	set test_ CBQ_FORMAL_TCP	$self next 0}Test/FORMAL_TCP instproc run {} {	$self instvar cbqalgorithm_ ns_ net_ topo_	set stopTime 40.1	set maxbytes 187500	set cbqalgorithm_ formal	$topo_ instvar cbqlink_	$self create_twoagency	$self insert_twoagency $cbqlink_	$self four_tcps	$self make_fmon $cbqlink_	[$cbqlink_ queue] algorithm $cbqalgorithm_	$self cbrDump4 $cbqlink_ 1.0 $stopTime $maxbytes	$self openTrace $stopTime CBQ_FORMAL_TCP	$ns_ run}TestSuite instproc finish_max tname {	global quiet PERL        $self instvar ns_ tchan_ testName_        exec $PERL ../../bin/getrc -s 2 -d 3 out.tr | \          $PERL ../../bin/raw2xg -s 0.01 -m 90 -t $tname > temp.rands        if {$quiet == "false"} {                exec xgraph -bb -tk -nl -m -x time -y packets temp.rands &        }        ## now use default graphing tool to make a data file        ## if so desired        if { [info exists tchan_] && $quiet == "false" } {                $self plotQueue $testName_        }        $ns_ halt}## Figure 11 from the link-sharing paper, but Formal (old) link-sharing.# WRR. # ~/newr/rm/testA.com DELETED## # To send five back-to-back packets for $audClass,#   maxidle should be 0.004 seconds# To send 50 back-to-back packets, maxidle should be 0.25 secondsClass Test/MAX1 -superclass TestSuiteTest/MAX1 instproc init topo {         $self instvar net_ defNet_ test_	Queue set limit_ 1000        set net_ $topo        set defNet_ cbq1-wrr        set test_ CBQ_MAX1        $self next 0}Test/MAX1 instproc run {} {        $self instvar cbqalgorithm_ ns_ net_ topo_ node_        set stopTime 2.1        set maxbytes 187500        set cbqalgorithm_ formal         $topo_ instvar cbqlink_        $self create_flat2 0.25 0        $self insert_flat2 $cbqlink_        $self two_cbrs 1000 1000 0.001 0.01 1        [$cbqlink_ queue] algorithm $cbqalgorithm_	TestSuite instproc finish tname { $self finish_max $tname }	$self traceQueues $node_(r1) [$self openTrace $stopTime CBQ_MAX1]        $ns_ run}Class Test/MAX2 -superclass TestSuiteTest/MAX2 instproc init topo {         $self instvar net_ defNet_ test_	Queue set limit_ 1000        set net_ $topo        set defNet_ cbq1-wrr        set test_ CBQ_MAX2        $self next 0}Test/MAX2 instproc run {} {        $self instvar cbqalgorithm_ ns_ net_ topo_ node_        set stopTime 2.1        set maxbytes 187500        set cbqalgorithm_ formal         $topo_ instvar cbqlink_        $self create_flat2 0.004 0        $self insert_flat2 $cbqlink_        $self two_cbrs 1000 1000 0.001 0.01 1        [$cbqlink_ queue] algorithm $cbqalgorithm_	TestSuite instproc finish tname { $self finish_max $tname }	$self traceQueues $node_(r1) [$self openTrace $stopTime CBQ_MAX2]        $ns_ run}## Set "extradelay" to 0.024 seconds for a steady-state burst of 2 #Class Test/EXTRA1 -superclass TestSuiteTest/EXTRA1 instproc init topo {         $self instvar net_ defNet_ test_        Queue set limit_ 1000        set net_ $topo        set defNet_ cbq1-prr        set test_ CBQ_EXTRA1        $self next 0}Test/EXTRA1 instproc run {} {        $self instvar cbqalgorithm_ ns_ net_ topo_ node_        set stopTime 2.1        set maxbytes 187500        set cbqalgorithm_ formal                $topo_ instvar cbqlink_         $self create_flat2 auto 0.024        $self insert_flat2 $cbqlink_        $self two_cbrs 1000 1000 0.015 0.01 0        [$cbqlink_ queue] algorithm $cbqalgorithm_        TestSuite instproc finish tname { $self finish_max $tname }        $self traceQueues $node_(r1) [$self openTrace $stopTime CBQ_EXTRA1]        $ns_ run}## Set "extradelay" to 0.12 seconds for a steady-state burst of 8 #Class Test/EXTRA2 -superclass TestSuiteTest/EXTRA2 instproc init topo {         $self instvar net_ defNet_ test_        Queue set limit_ 1000        set net_ $topo        set defNet_ cbq1-prr        set test_ CBQ_EXTRA2        $self next 0}Test/EXTRA2 instproc run {} {        $self instvar cbqalgorithm_ ns_ net_ topo_ node_        set stopTime 2.1        set maxbytes 187500        set cbqalgorithm_ formal                $topo_ instvar cbqlink_         $self create_flat2 auto 0.12        $self insert_flat2 $cbqlink_        $self two_cbrs 1000 1000 0.015 0.01 0        [$cbqlink_ queue] algorithm $cbqalgorithm_        TestSuite instproc finish tname { $self finish_max $tname }        $self traceQueues $node_(r1) [$self openTrace $stopTime CBQ_EXTRA2]        $ns_ run}# With Packet-by-Packet Round-robin, it is necessary either to# set a positive value for extradelay, or a negative value for minidle#Class Test/MIN1 -superclass TestSuiteTest/MIN1 instproc init topo {	$self instvar net_ defNet_ test_	set net_ $topo	set defNet_ cbq1-prr	set test_ CBQ_MIN1	$self next 0}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -