[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: monitor-queue questions
> Hi, there
>
> I am trying to monitor queueing length on a link, following the syntax on
> man page, but ns always reports I am missing a parameter, am I missing sth
> here? Another question is how can I get a trace of (time, queue length)?
>
> thanks a lot
>
> /oliver
>
>
> set qm [$ns monitor-queue $n5 $n6]
> $qm set size_
>
Yes, you need one more argument 'qtrace' (look at tcl/lib/ns-lib.tcl), a
channel id. That gets used (see tcl/lib/ns-link.tcl) only you invoke
'start-tracing' or 'queue-sample-timeout'. So you can do something like
below to get trace of time, qlen etc.
Hope this helps,
Srihari
#-----------------------------------------------------------------------
# instantiate a simulator
set ns [new Simulator]
# topology
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
# tcp connection
set src1 [new Agent/TCP]
set snk1 [new Agent/TCPSink]
$ns attach-agent $n0 $src1
$ns attach-agent $n1 $snk1
$ns connect $src1 $snk1
# ftp source
set ftp1 [$src1 attach-source FTP]
$ns at 1.0 "$ftp1 start"
# sample the q every sec. store the trace in qm.out
set qm [$ns monitor-queue $n0 $n1 [open qm.out w] 1];
[$ns link $n0 $n1] queue-sample-timeout; # [$ns link $n0 $n1] start-tracing
# run for 5 seconds
$ns at 5.0 "exit 0"
$ns run
#-----------------------------------------------------------------------