I have tracefile of three nodes (0 , 1 and 2 ) as follows:
+ 0.02 0 1 tcp 40 ------- 1 0.0 2.0 0 0
- 0.02 0 1 tcp 40 ------- 1 0.0 2.0 0 0
+ 0.02 2 1 tcp 40 ------- 2 2.1 0.1 0 1
- 0.02 2 1 tcp 40 ------- 2 2.1 0.1 0 1
r 0.025032 0 1 tcp 40 ------- 1 0.0 2.0 0 0
+ 0.025032 1 2 tcp 40 ------- 1 0.0 2.0 0 0
- 0.025032 1 2 tcp 40 ------- 1 0.0 2.0 0 0
r 0.025032 2 1 tcp 40 ------- 2 2.1 0.1 0 1
+ 0.025032 1 0 tcp 40 ------- 2 2.1 0.1 0 1
- 0.025032 1 0 tcp 40 ------- 2 2.1 0.1 0 1
r 0.030064 1 2 tcp 40 ------- 1 0.0 2.0 0 0
+ 0.030064 2 1 ack 40 ------- 1 2.0 0.0 0 2
- 0.030064 2 1 ack 40 ------- 1 2.0 0.0 0 2
r 0.030064 1 0 tcp 40 ------- 2 2.1 0.1 0 1
+ 0.030064 0 1 ack 40 ------- 2 0.1 2.1 0 3
- 0.030064 0 1 ack 40 ------- 2 0.1 2.1 0 3
r 0.035096 2 1 ack 40 ------- 1 2.0 0.0 0 2
+ 0.035096 1 0 ack 40 ------- 1 2.0 0.0 0 2
- 0.035096 1 0 ack 40 ------- 1 2.0 0.0 0 2
...............
...............
.............
I want an awk program which gives me an output file where : each time of node 1, i found total enqueed and total dequeed ( $3=="1") and their difference
like this form :
time ....tot of "+" by node 1....tot of "-"by node 1....(tot of "+" - tot of "-") by node 1
to have a curve : (tot of "+" - tot of "-") by node 1 = f( time )
i try this awk program :
BEGIN { t1=0;t2=0; t3=0;t4=0 }
{
if($1=="+" && $3=="1"&& $5=="tcp")
{if($1=="-")
{
t3+=$6;
}
t1=$2;
t2+=$6;
t4=t2-t3;
{print "\t\n"t1,t2,t3,t4}
}
}
END {""}
but without goud result
plz, i wait your help