File: drop.awk

package info (click to toggle)
ns2 2.35%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,864 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 818; awk: 525; csh: 355
file content (27 lines) | stat: -rwxr-xr-x 395 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/gawk -f
BEGIN {
	fsDrops = 0;
	otherDrops = 0;
}
($2 >= startTime && $2 <= endTime) {
	op = $1;
	time = $2;
	src = $9;
	dst = $10;
	if (match(src,"^0\.") && $1 == "+") {
		numFs++;
	}
	if (numFs > 0 && op == "d") {
		if (match(src,"^0\."))
			fsDrops++;
		else
			otherDrops++;
	}
	if (match(src,"^0\.") && ($1 == "-" || $1 == "d"))
		numFs--;
}

END {
	print otherDrops, fsDrops;
}