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

Re: Flowmon objects



hi sara,
	
Try something in these lines. It should work.

	
	
set flow_stat10 [open flow.stat10 w]	
set flowmon_10 [$ns makeflowmon Fid]
$ns attach-fmon [$ns link $n1 $n0] $flowmon_10 0
set_flowMonitor $flowmon_10 $flow_stat10
$ns at 5.0  "$flowmon_10 dump"

proc set_flowMonitor {flowmon output_chan} {

    $flowmon attach $output_chan
    set bytesInt_ [new Integrator]
    set pktsInt_ [new Integrator]
    $flowmon set-bytes-integrator $bytesInt_
    $flowmon set-pkts-integrator  $pktsInt_
    return $flowmon
}
You need to use the above procedure if you want to collect aggregate statistics
using integrators. If not you can get rid of it and attach the output channel
directly.

attach-fmon is a in-built tcl procedure in ns (ns/tcl/lib/ns-lib.tcl) and has 
the following code.

Simulator instproc attach-fmon {lnk fm { edrop 0 } } {
    set isnoop [new SnoopQueue/In]
    set osnoop [new SnoopQueue/Out]
    set dsnoop [new SnoopQueue/Drop]
    $lnk attach-monitors $isnoop $osnoop $dsnoop $fm
    if { $edrop != 0 } {
            set edsnoop [new SnoopQueue/EDrop]
            $edsnoop set-monitor $fm
            [$lnk queue] early-drop-target $edsnoop
            $edsnoop target [$self set nullAgent_]
    }
    [$lnk queue] drop-target $dsnoop
}

good luck
kedar

> 
> Hi,
>  I' m trying to collect per-flow statistics using a Flow monitor
> object.....I must admit quite unsuccessfully ...because the output
> file, which should contains the statistics, is empty.
> This is my piece of code. I' m positive there are many mistakes. But
> from  the manual pages  it' s difficult for me to understand exactly
> what I've to do.
> 
> set fmon [new QueueMonitor/ED/Flowmon]
> set cl [new Classifier/Hash/SrcDestFid 33]
> $fmon classifier $cl
> set frt1 [open frt1.out w]
> $fmon attach $frt1
> $ns at 5.0 "$fmon dump"
> 
> Could you help me , please?
> 
> Thanks a lot ,
> 
> Sara
> 
> 
>