-
Notifications
You must be signed in to change notification settings - Fork 0
/
w2.awk
54 lines (54 loc) · 1012 Bytes
/
w2.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
BEGIN{
highest_packet_id=0;
currentTime=previousTime=0
timetic=0.1
current_pkid=0
}
{
event=$1
time=$3
packet_id=$41
if(previousTime==0)
previousTime=time
if(event=="s")
{
if(packet_id>highest_packet_id)
highest_packet_id=packet_id;
if(start_time[packet_id]==0)
start_time[packet_id]=time;
}
else if(event=="r")
{
end_time[packet_id]=time;
currentTime=time-previousTime
if(currentTime>=timetic)
{
for(packet_id=current_pkid;packet_id<=highest_packet_id;packet_id++)
{
start=start_time[packet_id];
end=end_time[packet_id];
packet_duration=end-start;
if(start<end)
delay+=packet_duration;
}
printf("%f %f\n",time,delay);
currentTime=0
previousTime=time
current_pkid=highest_packet_id+1;
delay=0
}
}
else if(event=="d")
{
end_time[packet_id]=-1;
}
if($19=="AGT"&&event=="s")
start_time[packet_id]=$3;
else if(event=="r")
end_time[packet_id]=$3;
else if(event=="d")
end_time[packet_id]=-1;
}
END{
printf("\n");
}