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

[ns] monitor-queue continued



Hi all,

I've been struggling with the monitor-queue object now for a couple days and
I must say the results are mitigated.
So far I've been able to collect queue size using this script :

set qf [open queuemon1.queue w]
$ns monitor-queue $n0 $n1 $qf 0.5
set q [[$ns link $n0 $n1] queue-sample-timeout]


However, when i tried to collect other stats (like packets drops, ...) I
keep running into errors ... :((
Could someone please make the necessary additions to the following script so
I can gather stats i need ??


[root@ns NS]# ns queuemon3.tcl
ns: record: can't read "size_": no such variable
    while executing
"puts $qf "[$ns now] $size_ pkts_""
    (procedure "record" line 9)
    invoked from within
"record"



#Create a simulator object
set ns [new Simulator]

#Create 2 nodes
set n0 [$ns node]
set n1 [$ns node]

#Create 1 link between the nodes
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail

#Define a 'finish' procedure
proc finish {} {
        global n0 n1 ns qf q
        #Close the output files
        close $qf
        exit 0
}

proc record {} {
        global n0 n1 ns qf q size_ pkts_
        set qf [open queuemon3.queue w]
        $ns monitor-queue $n0 $n1 $qf 0.05
        set q [[$ns link $n0 $n1] queue]
        $q instvar size_ pkts_
        puts $qf "$size_ $pkts_"
}

Thx alot

Thomas