[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ns] some clarifications plz ...



Hey,

Thx alot for your kind answer

Unfortunately I was still not able to achieve the desired results :(

Just to remind you, i'd like to gather stats regarding a queue from node2 to
node3. The stats i'd like to get are size_ pkts_ barrivals_ bdepartures_
parrivals_ pdepartures_ bdrops_ pdrops_ bytesInt_ pktsInt_

The following script only gathers size stats for now ... but in fact it
generates the following error

[root@ns NS]# ns queuemon_x.tcl
ns: record: no value given for parameter "n1" to "_o3"
    (Simulator link line 1)
    invoked from within
"$ns link"
    (procedure "record" line 6)
    invoked from within
"record"


Here's what I did :

#Create a simulator object
set ns [new Simulator]

#Open the output file
set f0 [open queuemon_x.queue w]

#Define a 'finish' procedure
proc finish {} {
    global f0
    #Close the output files
    close $f0
    #Call xgraph to display the results
    exec xgraph queuemon_x.queue -geometry 1000x500 & -t "Queue Size" & -x
secondes & -y "Size" & -fg white & -bg black
    exit 0
}

proc record {} {
    global f0 sink0
    set time 1
    #Get an instance of the simulator
    set ns [Simulator instance]
    set q [[$ns link] $n2 $n3 queue]
    $q instvar size_
    #Get the current time
    set now [$ns now]
    puts $f0 "$now [expr $size]"
    #Re-schedule the procedure
    $ns at [expr $now+$time] "record"
}

..
..
..

$ns monitor-queue $n2 $n3 queuemon_x.queue


Much thx

Thomas


> The above statement is wrong,
>
> $ns monitor-queue $n2 $n3
>
> will give you the queue sizes for every 0.1 secs.  The last two arguments
> that you are talking about are optional arguments, the first one I suppose
> is the name of the file you want the values to be written into.  The
> second one is the interval at which your statistics gathering must happen.
> Be aware that "monitor-queue" only gives you queue sizes.
>
> However, you can get the values of all other variables that you mentioned.
>
>
> To do that,
>
>
> set q [[$ns link] $n1 $n2 queue]
> $q instvar size_ pkts_ .....
>
> Now, you should be able to print these values on to a file or stdout using
>
>
> puts $f "[$ns now]      $size"
>
>
> 'f above is the file handler'.
>
> Hope this helps,
> Sowmya.