[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Monitoring the queue size
Marta Solera wrote:
> Hi all,
>
> but i don't know how to monitor the queue size or the number of packets
> drops.
>
Hi,
Here you have an easy way of doing that:
###
# monitor the queue that buffers packets going from node n1 to node n2
set qmon [$ns monitor-queue $n1 $n2 0]
# queue size trace
set fqsize [open "qsize.n1-n2.out" w]
# no. of drops trace
set fqdrop [open "qdrop.n1-n2.out" w]
$ns at 0 "record"
proc record {} {
global ns qmon fqsize fqdrop
set time [$ns now]
set qsize [$qmon set pkts_]
set qdrop [$qmon set pdrops_]
puts $fqsize "$time $qsize"
puts $fqdrop "$time $qdrop"
$qmon reset
# stats every 1 second
$ns at [expr $time+1.0] "record"
}
proc finish {} {
global fqsize fqdrop
...
close $fqsize
close $fqdrop
...
}
###
Since you were trying to use "queue-sample-timeout", I assumed you wanted to
collect queue size and no. of drops at regular intervals. If what you want
is to collect all the changes, you'll have to use "trace-queue" and
post-process the trace.
Regards,
--
Felix Hernandez Campos
http://www.cs.unc.edu/~fhernand