[ns] Re: Fw: TCP + throughput and goodput calculation

Peter Dimopoulos dimpet at cs.rmit.edu.au
Sat Jan 31 17:21:00 PST 2004


Have a look at 
http://www.isi.edu/nsnam/ns/tutorial/index.html
http://nile.wpi.edu/NS/
for general topology setup.

You can get goodput and throughput by using the monitor-queue
like so (example is in Packets per second, you could do bytes per second
in a by using b instead of p)

set Variable(runtime)   5
set Variable(interval)  [expr $Variable(runtime) * 0.001]

<insert topology here>

set qfile [$ns monitor-queue $srouter $drouter \
                      [open $FileName(queue) w] $interval]
[$ns link $srouter $drouter] queue-sample-timeout;


proc record {} {
    global ns Variable
    set now [$ns now]

    $Variable(qfile) instvar barrivals_ parrivals_ pdepartures_ bdrops_ bdepartures_ pdrops_

    set Variable(goodput) [expr $Variable(goodput) + 1.0 * ($parrivals_/$Variable(interval))]
    set Variable(throughput) [expr $Variable(throughput) + 1.0 * ($pdepartures_/$Variable(interval))]

    set parrivals 0;
    set barrivals_ 0;
    set bdrops_ 0;
    set pdrops_ 0;
    set bdepartures_ 0;
    set pdepartures_ 0;

    set time $Variable(interval)
    $ns at [expr $now+$time] "record"
}

proc finish {} {
    global ns Variable
    $ns flush-trace

    set throughput [expr 1.0 *$Variable(throughput) * $Variable(interval)/$Variable(runtime)]
    puts "Throughput: $throughput"

    set goodput [expr 1.0 *$Variable(goodput) * $Variable(interval)/$Variable(runtime)]
    puts "Goodput: $throughput"

    exit 0
}

$ns at 0.1 "record"
$ns at $Variable(runtime) "finish"

$ns run

> Hello
> I'm new in ns and i need help.
> My network topology is something like that
>
> s1                                                      r1
>     \                                                   /
>       \                                               /
>         \                                           /
> s2----rout1--------------------rout2--------r2
>         /                                          \
>       /                                              \
>     /                                                  \
> s3                                                     s3

> One one side I have TCP/newReno agents and FTP sources and on the other side
> i have TCPSink
> Type of queue manager between rout1 and rout2 is RED ( in my projekt i need
> to test it)
> I need to get the information about goodput and throughput in this network
> and compare it with network with DropTail.
> How can i get this data.
> And i repeat. I'm new user so if you can show me some expamples.
> I have heard that i have to add some variable to TCPSink to get amount of
> bytes recived.
> But i don't know how.
> Is there in TCPAgent some variable wich i can see to get amount of bytes
> sended ?
> Thanks for your help
> Grzegorz Pawlowski



More information about the Ns-users mailing list