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

📄 http-mult.tcl

📁 NS-2.28的802.11e协议扩展源代码
💻 TCL
📖 第 1 页 / 共 2 页
字号:
}proc setup_http_test {} {    global testnet flows background    create_testnet    set trigger $testnet(starttime)    for {set pair 0} {$pair < $testnet(clickers)} {incr pair} {	set base [expr $pair * $flows(flows_per)]	set ident $base	set inlines_started [format "inlines_started%d" $base]	set flows_running [format "flows_running%d" $base]	set inlines_running [format "inlines_running%d" $base]	set counter [format "count%d" $ident]	set flows($inlines_started) 0	set flows($flows_running) 0	set flows($inlines_running) 0	init_tcp_flow $testnet(httpsize) $pair $ident	set flows($counter) 0	for { set i 1 } { $i <= $flows(inlines_needed) } { incr i } {	    incr ident	    init_tcp_flow $testnet(inlinesize) $pair $ident	}	ns at $trigger "start_http $base"	set addms [expr ($testnet(clickdelay) * ([ns-random] >> 16)) >> 16]	set trigger [expr $trigger + (0.001 * $addms)]		    }    set testnet(needed) 0    set flows(total_running) 0    set trigger $background(start)    set offset [expr $testnet(clickers) * (1 + $flows(inlines_needed))]    for {set pair 0} {$pair < $background(nflows)} {incr pair} {	set ident [expr $offset + ($pair % $background(numisp))]	set client [format "c%d" $ident]	set server [format "s%d" $ident]	set isp [format "isp%d" $ident]	set ident [expr $offset + $pair + 1]	set flow [ns_create_connection tcp-reno \		$testnet($server) tcp-sink $testnet($client) $ident]	$flow set window $background(window)	$flow set packet-size $background(mss)	$flow set maxcwnd $background(window)	set tcp_id [$flow source ftp]	set bkgsize [expr $background(minsize) \		+ ((($background(maxsize) - $background(minsize)) \		* ([ns-random] >> 16)) >> 16)]	$tcp_id set maxpkts_ $bkgsize	if {$testnet(quiet) == 0} {	    puts [format "at %7.3f start background flow %d - %d" \		    $trigger $pair $bkgsize]	}	ns at $trigger "$tcp_id start"	set addms [expr ($background(delay) * ([ns-random] >> 16)) >> 16]	set trigger [expr $trigger + (0.001 * $addms)]    }    # trace only the NSP bottleneck link    set traceme [openTrace $testnet(testlimit) test_http]    set bottleneck [ns link $testnet(nsp2) $testnet(nsp1)]    $bottleneck trace $traceme    $bottleneck callback { trigger }    if {$testnet(gen_map)} {	ns gen-map    }}proc start_http { base } {    global testnet flows    set flows_running [format "flows_running%d" $base]    incr flows($flows_running)    set flow tcp$base    if {$testnet(quiet) == 0} {	puts [format "at %7.3f start http%d" [ns now] $base]    }    $flows($flow) start    incr testnet(needed) $testnet(httpsize)    incr flows(total_running)    set isrunning isrunning$base    set flows($isrunning) 1    set first first$base    set flows($first) [ns now]    set last last$base    set flows($last) flows($first)}proc set_globals {} {    global testnet flows background    set testnet(starttime) 10.0    set testnet(netdelay) 35ms    set testnet(modemdelay) 50ms    set testnet(ispdelay) 25    set testnet(taildelay_lo) 1    set testnet(taildelay_hi) 25    set testnet(netspeed) 512kb    set testnet(modemspeed) 28.8kb    set testnet(ispspeed) 1.54mb    set testnet(window) 64    set testnet(mss) 512    set testnet(httpsize) 6    set testnet(inlinesize) 40    set testnet(modemqueue) 24    set testnet(netqueue) 40    set testnet(clickers) 10    set testnet(clickdelay) 500    set testnet(testlimit) 500.0    set testnet(quiet) 0    set testnet(verbose) 1    set testnet(seed) 1    set testnet(netqtype) drop-tail    set testnet(modemqtype) drop-tail    set testnet(doproxy) 0    set testnet(bkgproxy) 0    set testnet(numisp) 2    set testnet(gen_map) 0    set flows(inlines_started) 0    set flows(inlines_needed) 3    set flows(flows_running) 0    set flows(flows_allowed) 4    set flows(inlines_running) 0    set flows(inlines_allowed) $flows(flows_allowed)    set flows(flows_per) [expr $flows(inlines_needed) + 1]    set flows(persist) 0    set background(nflows) 150    set background(start) 0.0    set background(window) 64    set background(mss) 512    set background(minsize) 2    set background(maxsize) 120    set background(delay) 2000    set background(numisp) [expr $background(nflows) >> 4]}proc process_args {} {    global argc argv testnet flows background    for {set i 0} {$i < $argc} {incr i} {	set arg [lindex $argv $i]	switch x$arg {	    x-delayN {		incr i		set testnet(netdelay) [lindex $argv $i]	    }	    x-delayM {		incr i		set testnet(modemdelay) [lindex $argv $i]	    }	    x-delayI {		incr i		set testnet(ispdelay) [lindex $argv $i]	    }	    x-delayTlo {		incr i		set testnet(taildelay_lo) [lindex $argv $i]	    }	    x-delayThi {		incr i		set testnet(taildelay_hi) [lindex $argv $i]	    }	    x-delayT {		incr i		set testnet(taildelay_hi) [lindex $argv $i]		set testnet(taildelay_lo) 0	    }	    x-netspeed {		incr i		set testnet(netspeed) [lindex $argv $i]	    }	    x-ispspeed {		incr i		set testnet(ispspeed) [lindex $argv $i]	    }	    x-modemspeed {		incr i		set testnet(modemspeed) [lindex $argv $i]	    }	    x-window {		incr i		set testnet(window) [lindex $argv $i]		if {$testnet(bkgproxy)} {		    set background(window) [lindex $argv $i]		}	    }	    x-mss {		incr i		set testnet(mss) [lindex $argv $i]	    }	    x-httpsize {		incr i		set testnet(httpsize) [lindex $argv $i]	    }	    x-inlinesize {		incr i		set testnet(inlinesize) [lindex $argv $i]	    }	    x-modemqueue {		incr i		set testnet(modemqueue) [lindex $argv $i]	    }	    x-netqueue {		incr i		set testnet(netqueue) [lindex $argv $i]	    }	    x-testlimit {		incr i		set testnet(testlimit) [lindex $argv $i]	    }	    x-clickers {		incr i		set testnet(clickers) [lindex $argv $i]	    }	    x-clickdelay {		incr i		set testnet(clickdelay) [lindex $argv $i]	    }	    x-inlines {		incr i		set flows(inlines_needed) [lindex $argv $i]	    }	    x-maxflow {		incr i		set flows(flows_allowed) [lindex $argv $i]	    }	    x-maxinline {		incr i		set flows(inlines_allowed) [lindex $argv $i]	    }	    x-bkg-flows {		incr i		set background(nflows) [lindex $argv $i]	    }	    x-bkg-window {		incr i		set background(window) [lindex $argv $i]	    }	    x-bkg-mss {		incr i		set background(mss) [lindex $argv $i]	    }	    x-bkg-minsize {		incr i		set background(minsize) [lindex $argv $i]	    }	    x-bkg-maxsize {		incr i		set background(maxsize) [lindex $argv $i]	    }	    x-bkg-delay {		incr i		set background(delay) [lindex $argv $i]	    }	    x-start {		incr i		set testnet(starttime) [lindex $argv $i]	    }	    x-bkg-start {		incr i		set background(start) [lindex $argv $i]	    }	    x-numisp {		incr i		set testnet(numisp) [lindex $argv $i]	    }	    x-bkgisp {		incr i		set background(numisp) [lindex $argv $i]	    }	    x-seed {		incr i		set testnet(seed) [lindex $argv $i]	    }	    x-modemred {		set testnet(modemqtype) red	    }	    x-netred {		set testnet(netqtype) red	    }	    x-red {		set testnet(netqtype) red		set testnet(modemqtype) red	    }	    x-sfq {		set testnet(netqtype) sfq	    }	    x-proxy {		set testnet(doproxy) 1	    }	    x-bkgproxy {		set testnet(bkgproxy) 1		set background(window) 16	    }	    x-allproxy {		set testnet(doproxy) 1		set testnet(bkgproxy) 1		set background(window) 16	    }	    x-tail {		set testnet(netqtype) drop-tail		set testnet(modemqtype) drop-tail	    }	    x-persist {		set flows(persist) 1	    }	    x-nopersist {		set flows(persist) 0	    }	    x-quiet {		set testnet(quiet) 1	    }	    x-ns-gen-map {		set testnet(gen_map) 1	    }	    default {		puts [format "unrecognized argument: %s" [lindex $argv $i]]		exit 1	    }	}    }}proc report_conditions {} {    global testnet flows background    if {$flows(inlines_allowed) > $flows(flows_allowed)} {	set flows(inlines_allowed) $flows(flows_allowed)    }    puts [format "delays: net %s, modem %s, isp 0-%dms, tail %d-%dms" \	    $testnet(netdelay) $testnet(modemdelay) $testnet(ispdelay) \	    $testnet(taildelay_lo) $testnet(taildelay_hi)]    puts [format "link speeds: net %s, modem %s, isp %s" \	    $testnet(netspeed) $testnet(modemspeed) $testnet(ispspeed)]    puts [format "queues: modem %d, net %d, (isp and tail not congested)" \	    $testnet(modemqueue) $testnet(netqueue)]    if {$flows(persist)} {	set ispersistant "HTTP 1.1 (persistent)"    } else {	set ispersistant "pre- HTTP 1.1"    }    puts [format "window %d, mss %d, %s, http %d(%d), inline %d(%d)" \	    $testnet(window) $testnet(mss) $ispersistant \	    $testnet(httpsize) [expr $testnet(mss) * $testnet(httpsize)] \	    $testnet(inlinesize) [expr $testnet(mss) * $testnet(inlinesize)]]    puts [format "sources: %d clickers, spaced 0-%dms, seed for random= %d" \	    $testnet(clickers) $testnet(clickdelay) $testnet(seed)]    puts [format \	    "%d inlines per page, %d flows per client, %d inlines running" \	    $flows(inlines_needed) $flows(flows_allowed) \	    $flows(inlines_allowed)]    puts [format \	    "%d bkg flows, window %d, mss %d, size %d-%d pkts, every 0-%dms" \	    $background(nflows) $background(window) $background(mss) \	    $background(minsize) $background(maxsize) $background(delay)]    puts [format "start bkg at %s, test at %s, run test for %s seconds" \	    $background(start) $testnet(starttime) $testnet(testlimit)]    if {$testnet(doproxy)} {	set doingproxy "proxy HTTP"    } else {	set doingproxy "no proxy HTTP"    }    if {$testnet(bkgproxy) > 1} {	set dobkgproxy "bkg proxy HTTP"    } else {	set dobkgproxy "no bkg proxy"    }    puts [format "queue: modem= %s, net= %s, %s, %s" \	    $testnet(modemqtype) $testnet(netqtype) $doingproxy $dobkgproxy]}set_globalsprocess_argsreport_conditionssetup_http_testns run

⌨️ 快捷键说明

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