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

parrivals_ & barrivals_



Hello ns-developers,

I applied a patch from Srihari that fixes a problem that I have encountered 
when monitoring packet arrivals of multicast traffic (variables parrivals_ and 
barrivals_ of QueueMonitor). Though I do not have the time to fully dive into 
the source code and validate the modification, packet arrival monitoring turns 
out to work fine now for both unicast- and multicast traffic.

Let me therefore recommend Srihari's patch to you as the basis for integration 
into future releases. I appreciate to hear your comments about possible side 
effects that could be introduced by the bugfix.

  Greetings,

     -Chris.


--------------------------------------------------------------------


There seem to be a minor bug (in ns-2.1b1) in the way queue monitors are
attached when the 'NumberInterfaces_'  is  set.  Basically i  tried  the
following simple  test  and   got  the attached results.   Looks    like
'snoopIn'  is not in   the path of  pkt.   I guess  the problem  is that
'head_' (entry to link) and 'ifacein_' (which is used by mcast code) are
not  kept   consistent.   I  have  made   a minor   modification  to the
'attach-monitors' method in 'ns-link.tcl'  (listed below) and it seem to
help.  I am not  sure whether this problem  was reported earlier. Anyway
please let me know if i am wrong or if u need any clarification.

Thanks,
Srihari

#------------------------------------------------------------------------------
SimpleLink instproc attach-monitors { insnoop outsnoop dropsnoop qmon } {
	$self instvar drpT_ queue_ head_ snoopIn_ snoopOut_ snoopDrop_
	$self instvar qMonitor_ drophead_

	set snoopIn_ $insnoop
	set snoopOut_ $outsnoop
	set snoopDrop_ $dropsnoop

        # added by [email protected]
	$self instvar ifacein_ source_
        if { [$source_ info class] == "DuplexNetInterface" } {
	        $snoopIn_ target [$ifacein_ target]
                $ifacein_ target $snoopIn_
        } else {
	        $snoopIn_ target $head_
        	set head_ $snoopIn_
        }

	$snoopOut_ target [$queue_ target]
	$queue_ target $snoopOut_

	set nxt [$drophead_ target]
	$drophead_ target $snoopDrop_
	$snoopDrop_ target $nxt

	$snoopIn_ set-monitor $qmon
	$snoopOut_ set-monitor $qmon
	$snoopDrop_ set-monitor $qmon
	set qMonitor_ $qmon
}
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# mcast test simulation
set ns [new Simulator]
Simulator set EnableMcast_ 1
Simulator set NumberInterfaces_ 1

# topology
set n0 [$ns node]
set n1 [$ns node]
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail

# mcast type
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]

# source
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
$cbr0 set dst_ 0x8001
$ns at 1.0 "$cbr0 start"

# receiver
set rcvr [new Agent/LossMonitor]
$ns attach-agent $n1 $rcvr
$ns at 1.2 "$n1 join-group $rcvr 0x8001"
$ns at 4.2 "$n1 leave-group $rcvr 0x8001"

# keep an eye on the q
proc eyeq {qmon ist} {
    global ns;

    set curt [$ns now]
    set pkts [$qmon set pkts_];
    set pars [$qmon set parrivals_];
    set ptxs [$qmon set pdepartures_];
    set pdrs [$qmon set pdrops_];
    puts [format "%9.3f %9d %9d %9d %9d" $curt $pkts $pars $ptxs $pdrs];

    $ns at [expr $curt + $ist] "eyeq $qmon $ist"
}

set f [open dummy.out w]
set qmon [$ns monitor-queue $n0 $n1 $f];
puts [format "%9s %9s %9s %9s %9s" "time" "qulen" \
	     "#arvls" "#xmits" "#drops"];
$ns at 1.0 "eyeq $qmon 1"

# run for 5 secs
$ns at 5.0 "exit 0"
$ns run
#------------------------------------------------------------------------------
# with original code
     time     qulen    #arvls    #xmits    #drops
    1.000         0         0         0         0
    2.000      -216         0       216         0
    3.000      -483         0       483         0
    4.000      -749         0       749         0
#------------------------------------------------------------------------------
# after the modification
     time     qulen    #arvls    #xmits    #drops
    1.000         0         0         0         0
    2.000         0       216       216         0
    3.000         0       483       483         0
    4.000         0       749       749         0
#------------------------------------------------------------------------------