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

Re: [ns] FlowMonitor <-- Please someone help me !





Thomas Kuborn wrote:

> I am monitoring 2 tcp flows (flow id 0 & 1) on the link n1 - n3
>
> With my current script, the output file with the flows looks like this :
>
>    0.300 0 0 2 0 0 3 31 9300 0 0 38 12800 0 0 0 0 0 0
>    0.300 1 0 2 1 2 3 7 3500 0 0 38 12800 0 0 0 0 0 0
>    0.400 0 0 2 0 0 3 71 21300 0 0 102 36800 0 0 0 0 0 0
>    0.400 1 0 2 1 2 3 31 15500 0 0 102 36800 0 0 0 0 0 0
>
> So its doing its job !
> The only problem i have is that i would like to collect the same stats I
> collected using monitor-queue.
> I'd like to get are size_ pkts_ barrivals_ bdepartures_ parrivals_
> pdepartures_ bdrops_ pdrops_.

Assuming your codes are working correctly, and you have already
collected the
flows stats as shown above, it's very simple to extract information you
need
from that file . However, it seems to me that the information collected
using
flow-monitor is not completed. I mean we can not get information such as
queue
size, bdepatures and pdepartures.  You can check file    flowmon.cc  for
details
of the format of the collected stats. Does anyone have any idea about
that.

Here is a samples of additional codes to extract barrivals, (parrivals,
bdrops,
pdrops are all similar)

# post-simulation data processing procedure for flow from n1 -> n3
# for example to get barrivals (in bytes) for different flows:
# from n0 -> n3 (barrivals_0), from n2 -> n3 (barrivals_2) and total
(barrivals)

proc get_barrivals {} {
set flow_stat_0 [open flow0_adv.stat r]
set barrivals_0 [open barrivals_0.stat w]
set barrivals_2 [open barrivals_2.stat w]
set total_barrivals [open barrivals.stat w]

while {[gets $flow_stat_0 one_line_stat0] >=0} {

 # check file flowmon.cc for the format of the flow stats

 set time [lindex $one_line_stat0 0]  ;# the first recorded variable is
time
 set flowid [lindex $one_line_stat0 1] ;# the second variable is flow_ID
 # variable number 9 is barrival for that single flow with the specified
flow id

 set single_flow_barrivals [lindex $one_line_stat0 8]
 set barrivals [lindex $one_line_stat0 12]

 # write the wanted stats to the associated files for displaying
 if {$flowid == 0} {
  puts $barrivals_0 "$time $single_flow_barrivals"
 } else {
  puts $barrivals_2 "$time $single_flow_barrivals"
 }

 puts $total_barrivals "$time $barrivals"

}

close $flow_stat_0
close $barrivals_0
close $barrivals_2
close $total_barrivals

# Call xgraph to display the results of barrivals for different flow id
exec xgraph barrivals_0.stat barrivals_2.stat barrivals.stat -geometry
800x400 &

exit 0

}



and I have also attached the working version based on your original
codes.

Bye the way, there's one line in your codes (below) I don't understand,
and
don't know where to find more information about it (I am new to NS).
Could you
point me to where I can find more info about the following:

#On cree 2 flow-monitor
set flowmon_0 [$ns makeflowmon Fid]
<=========
...


Thanks

Huan

flow_monitor.tcl