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

[ns] Flowmon Question




Hi I have a question on flowmon, I would like to collect specific info on a
link. The following is my code ... ... 

I have 2 flows with fid_ 1 and fid_2.

=====================================================
code 1
=====================================================
set fflow1 [open flow1.fm w]

set getlink [$ns link $R2 $R3]
set fmon [$ns makeflowmon Fid]
$ns attach-fmon $getlink $fmon
$fmon attach $fflow1

for {set i 0} {$i <= $sim_end} {set i [expr $i + 0.1]} {
	$ns at $i "$fmon dump"
}

=======================================================

My code does dump the per flow info into a file called flow1.fm, but it contains
many info that I'm not interested and it also dump info on both flows....(fid_1
& fid_ 2).  Is there a way just to dump the specific info of a flow.
I try to write a proc for this , but I encounter an error " invalid command
name :  $flow($i) set pkts_"

=============================================================
code 2
==============================================================
set fflow1 [open flow1.fm w]
set fflow2 [open flow2.fm w]

set getlink [$ns link $R2 $R3]
set fmon [$ns makeflowmon Fid]
$ns attach-fmon $getlink $fmon

proc flowdata { } {
	global ns fmon fflow1 fflow2
	
	set now [$ns now]
	set fcl [$fmon classifier]
	
	set fids {1 2}
	
	foreach i $fids {
		set flow($i) [$fcl lookup auto 0 0 $i]
		if {$flow($i) != " "} {
  			set curq($i) [$flow($i) set pkts_] 		
			set fpdrop($i) [$flow($i) set pdrops_] 			
			set fparrv($i) [$flow($i) set parrivals_] 			
			set fpdep($i) [$flow($i) set pdepartures_] 	
	 			
				if {$i == 1} {
				puts $fflow1 [format "%9.3f %9.3f %9.3f %9.3f \
				%9.3f %9.3f" $now $i $curq($i) $fpdrop($i)
				$fparrv($i) $fpdep($i)] 
				}
				else {
				puts $fflow1 [format "%9.3f %9.3f %9.3f %9.3f \
				%9.3f %9.3f" $now $i $curq($i) $fpdrop($i)
				$fparrv($i) $fpdep($i)]
				}	
		}
	} 	
}
 
for {set i 0} {$i <= $sim_end} {set i [expr $i + 0.1]} {
	$ns at $i "flowdata"
}

=============================================================

Sorry  for the long e-mail, hope that someone could point to me where I go
wrong.

Many Thanks.

Don