[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Reg bandwidth utilization!!
hi,
here's a program to calculate RTT for every 0.01 secs.
u may take the average and ofcourse half the value of that average would
give u END-TO-END DELAY.
proc roundtrip {} {
global ns tcp1 trace_rtt
set time 0.01
# if u want to know the rtt for each packet u may set
#time as 1/(rate) or interval-time....
set curr_rtt [$tcp1 set rtt_]
set now [ns now]
puts $trace_rtt "$now $curr_rtt"
ns at [expr $now+$time] "roundtrip"
}
do correct me if i am wrong....
hope this helps.
regards
chitti
On Mon, 9 Jul 2001, Ganesh wrote:
> Hi ,
>
> I got two questions...
>
> 1) For this to work, dont we have to declare bytes_ in tcp-sink.cc and
> tcp.sink.h ?? And increment it accordingly ?? Or is it a different bytes_
> that you are referring to ? and this gives me the effective throughput /
> goodput seen by the sink , right ?
>
> 2) How do we measure end-end delay using this method ? Which variable gives
> me this info ?
>
> Thanks.
>
> - Ganesh
>
> "T. Chitti Babu" wrote:
>
> > ANOTHER OPTION WOULD BE TO...
> >
> > set f0 [open src0.tr w]
> >
> > proc finish {} {
> > global ns nf f0
> > $ns flush-trace
> > close $f0
> > exec xgraph -m src0.tr -geometry 800x400 &
> > exit 0
> > }
> >
> > #Define a procedure which periodically records the bandwidth received by
> > the #traffic sink sink0 and writes it to the file f0.
> >
> > proc record {} {
> > global sink0 f0
> >
> > set ns [Simulator instance]
> >
> > #Set the time after which the procedure should be called again
> > set time 0.5
> >
> > #How many bytes have been received by the traffic sink?
> > set bw0 [$sink0 set bytes_]
> >
> > #Get the current time
> > set now [$ns now]
> >
> > #Calculate the bandwidth (in MBit/s) and write it to the file
> > puts $f0 "$now [expr $bw0/$time*8/1000000]"
> >
> > #Reset the bytes_ values on the traffic sink
> > $sink0 set bytes_ 0
> >
> > #Re-schedule the procedure
> > $ns at [expr $now+$time] "record"
> > }
> >
> > U NEED TO CALL THIS PROCEDURE INITIALLY IN THE MAIN PROGRAM.
> > $ns at 0.0 "record"
> > $ns at 100.0 "finish" // to stop the simulation.
> >
> > THEN THE FILE TO WHICH "f0" is the file descipter shows the o/p as
> > 0.0 0.00
> > 0.5 6.7
> > 1.0 6.9
> > 1.5 8.4
> >
> > --
> >
> > T.Chitti Babu (H-7, # 133)
> > KReSIT , IITBombay
> > MUMBAI-400076
> >
> > ---------------------------------------------
> >
> > INTERNAL PH NOS:
> > KReSIT Lab -- 5785
> > Hostel 7 No - 5607
> >
> > EXTERNAL PH NOS:
> > HOSTEL 7 Nos : 5721049, 5720105
>
> --
>
>
--
T.Chitti Babu (H-7, # 133)
KReSIT , IITBombay
MUMBAI-400076
---------------------------------------------
INTERNAL PH NOS:
KReSIT Lab -- 5785
Hostel 7 No - 5607
EXTERNAL PH NOS:
HOSTEL 7 Nos : 5721049, 5720105