[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to use xgraph for packet no. Vs time
Rajesh Khetan wrote:
> Hi,
>
> I would really appreciate if somebody could tell me how to use xGraph for
> packet No. Vs time Plotting.
>
> Thank you very much
>
> rajesh
>
In your .tcl file do this:
proc record {} {
global sink f0
set ns2 [Simulator instance]
set time 0.01
set bytrec [expr [$sink set bytes_]/1000]
set now [$ns2 now]
puts $f0 "$now $bytrec"
$sink set bytes_ 0
$ns2 at [expr $now+$time] "record"
}
then run xgraph with the file represented by $f0
Good luck