[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Reg bandwidth utilization!!
Two suggestions:
1) Try using gawk. In my version of awk or nawk, the >= operator did not function
properly, so the same script would show right results with gawk, but wrong with
awk or nawk. I don't know awk version, man page says: SunOS 5.7 Last
change: 18 Mar 1997.
2) Use the $ns trace-all command. The .tr files are smaller than nam files and
(in my opinion) easier to process. The nam files have a lot of irrelevant info,
like colors, node positions etc.
If you still want to process nam files, here is a slightly changed version of L.
Wood's script for delays. Sorry for formatting, copy-paste deleted the tabs. It
merely uses the lines of the nam file that have an action of "+,-,h,d,r", thus
ignoring any unneeded lines.
Also in my computer LC_NUMERIC was set to "de" and as all floating point numbers
were interpreted wrong. You might want to set it to "us".
BEGIN {
# simple awk script to generate end-to-end packet lifetime statistics
# in a form suitable for plotting with xgraph.
# Lloyd Wood, July 1999.
# http://www.ee.surrey.ac.uk/Personal/L.Wood/ns/
# Note by Nick Katsarakis: set your LC_NUMERIC enviroment variable to us
# otherwise the tmme is interpreted as integer
# eg. for bash use the command 'export LC_NUMERIC=us'
# and for csh : 'setenv LC_NUMERIC us'
highest_packet_id = 0;
}
{
action = $1;
if ((action=="+")||(action=="-")||(action=="h")||(action=="d")||(action=="r")) {
time = $3;
node_1 = $5;
node_2 = $7;
packet_type = $9;
packet_size = $11;
flow_id = $13;
packet_id = $15;
packet_attr = $17;
node_1_address = $19;
node_2_address = $20;
seq_no = $21;
if ( packet_id > highest_packet_id ) highest_packet_id = packet_id;
# getting start time is not a problem, provided you're not starting
# traffic at 0.0.
# could test for sending node_1_address or flow_id here.
if ( start_time[packet_id] == 0 ) start_time[packet_id] = time;
# only useful for small unicast where packet_id doesn't wrap.
# checking receive means avoiding recording drops
if ( action != "d" ) {
if ( (action == "r" ) && (( packet_type == "tcp") || ( packet_type == "ack" )))
{
# could test for receiving node_2_address or flow_id here.
end_time[packet_id] = time;
}
} else {
end_time[packet_id] = -1;
}
} #end if ((action...
}
END {
for ( packet_id = 0; packet_id <= highest_packet_id; packet_id++ ) {
start = start_time[packet_id];
end = end_time[packet_id];
packet_duration = end - start;
if ( start < end ) printf("%f %f\n", start, packet_duration);
}
}
Ganesh Gopalakrishnan wrote:
> Hi,
>
> OS: Linux 7.1
> Awk : GNU Awk 3.0.6
> NS: 2.1b7a
>
> I am running it at command line only, Not in perl or anything else..
> Usage:
> cat out.nam | awk -f <program-source file>
>
> I tried out with just > first, but highest pkt was always at 0, SO i tried
> GT and it worked !! :-)
>
> And, regd the output, I was talking about the out.nam file format, I
> was trying to apply on the out.nam file. And my nam output file looks
> like this
>
> ------------
>
> + -t 0.5 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 0 -a 2 -x {0.0 1.0 0 -------
> null}
> - -t 0.5 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 0 -a 2 -x {0.0 1.0 0 -------
> null}
> h -t 0.5 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 0 -a 2 -x {0.0 1.0 -1 -------
> null}
> r -t 0.526 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 0 -a 2 -x {0.0 1.0 0 -------
> null}
> + -t 0.526 -s 1 -d 0 -p ack -e 40 -c 2 -i 1 -a 2 -x {1.0 0.0 0 -------
> null}
> - -t 0.526 -s 1 -d 0 -p ack -e 40 -c 2 -i 1 -a 2 -x {1.0 0.0 0 -------
> null}
> h -t 0.526 -s 1 -d 0 -p ack -e 40 -c 2 -i 1 -a 2 -x {1.0 0.0 -1 -------
> null}
> r -t 0.53664 -s 1 -d 0 -p ack -e 40 -c 2 -i 1 -a 2 -x {1.0 0.0 0 -------
> null}
> + -t 0.53664 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 2 -a 2 -x {0.0 1.0 0 -------
> null}
> - -t 0.53664 -s 0 -d 1 -p cbr -e 1000 -c 2 -i 2 -a 2 -x {0.0 1.0 0 -------
> null}
>
> -----------
>
> Thanks,
>
> Ganesh
>
> On Tue, 10 Jul 2001, Lloyd Wood wrote:
>
> > Date: Tue, 10 Jul 2001 18:06:48 +0100 (BST)
> > From: Lloyd Wood <[email protected]>
>
> > What awk variant are you using, on what OS? I've never seen that.
> > As far as I know, GT is not a valid awk, nawk or gawk operator. Are
> > you trying to run this in perl or something?
>
> >
> >
> > > And another thing was that the format of log file had also changed, so , I
> > > had to change it for the newer format
> >
> > What newer format? This is for the standard ns trace-all format
> > described in section 22.4 of the ns Manual, Trace File Support.
> >
> > http://www.isi.edu/nsnam/ns/doc/node232.html
> >
> > (and not some munged wireless version).
> >
> > L.
> >
> > <[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>
> >
> >
> >