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

[ns] procedure-core dump



Hi, ns2-users,
I want to measure the bandwidth of serveral flow every period of time,
so I wrote the following script
############################################################################
#################
#for {set i 0} {$i <= 9} {incr i 1} {
# set file [open $i.tr w]
# $ns at [expr ($i+0.0000010)*10] "$ns trace-queue $n3 $n4 $file"
# $ns at [expr ($i+0.9999950)*10] "close $file; puts stdout $i; measure
$i.tr"
#}
############################################################################
#################

the 'measure' will read for the file, and select the 'r' entry to calculate
bandwidth,
it worked since I have try for many times.
############################################################################
#################
#proc measure { file } {
# global bandwidth1 bandwidth2
# set f [open $file r]
# set receive1 0; set receive2 0
# while {[gets $f line]>=0} {
#  if {[lindex $line 0]=="r"} {
#   if {[lindex $line 7]=="1"} {
#    set receive1 [expr $receive1+[lindex $line 5]]
#   }
#   if {[lindex $line 7]=="2"} {
#    set receive2 [expr $receive2+[lindex $line 5]]
#   }
#  }
# }
# close $f
# set bandwidth1 [expr $receive1*8/10]
# set bandwidth2 [expr $receive2*8/10]
# puts stdout "$bandwidth1 $bandwidth2"
#}
############################################################################
#################

however, when I combine them, sometimes it worked.
But sometimes not, especially when there are a lot of traffic and agents,
if I add WFQ, this goes worse.

The error messages are      1.Segmentation fault(core dump)
                                        2.Tcl_write translation fault...
Does the method go wrong or is this caused by slow CPU?
Please give me any advise, thank you.

Ken