After running your NS-2 program you will have a trace file as output.
Let us assume the name of the output file is "trace1.tr"
The trace file might look like below
+ 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
- 1 0 2 cbr 210 ------- 0 0.0 3.1 0 0
r 1.00212 0 2 cbr 210 ------- 0 0.0 3.1 0 0
+ 1.00212 0 2 cbr 210 ------- 0 0.0 3.1 0 0
+ 1.055 0 3 cbr 210 ------- 0 0.0 3.1 0 0
I am not explaining the meaning of the trace file. Instead I am giving instructions to use xgraph to draw a graph involving data extracted from the trace file.
To use xgraph we need 2 columns of data. The Unix command called "cut" is used for this purpose.
Open terminal and type the following commands
###############################
cut -d " " -f 2 trace1.tr > file1
cut -d " " -f 6 trace1.tr > file2
paste file1 file2 > output
xgraph output
###############################
This will extract columns 2 and 6 and then draw a graph using the xgraph utility.
for "cut" keyword -d specifies the delimiter between columns.
Here the delimiter is white space (" ").
-f specifies the column number of the data to be extracted.
thank you.. very useful
ReplyDeletehow can i write this command in terminal
Deletethank you
Deleteplz tell me, commands for executing xgraph in ns2
ReplyDelete@aks type command on terminal
ReplyDeletexgraph ur_file_name (which is having co-ordinate x y)
hi,
ReplyDeleteI have some result in delay.tr , I want to display in Xgraph .
How i can do that ?
how to define xgraph intcl program?pls rply
ReplyDelete