File: filter.awk

package info (click to toggle)
sockperf 3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,912 kB
  • sloc: cpp: 8,092; perl: 7,225; sh: 3,254; makefile: 114; awk: 93
file content (19 lines) | stat: -rwxr-xr-x 531 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/awk -f
BEGIN {
	# this syntax will allow --assign var=val in command line
	if (!RANGE_START_USEC) RANGE_START_USEC = 20
	if (!RANGE_START_END)  RANGE_END_USEC   = 1000*1000*1000
	if (!DECIMAL_DIGITS)   DECIMAL_DIGITS   = 9
	dataStarted = 0
}

$1 == "txTime," {dataStarted = 1; print "txTime, usecLat"}
{
	if (!dataStarted) print
	else {
        	usecLat = 1000*1000*($2 - $1)/2
	        if (RANGE_START_USEC <= usecLat && usecLat <= RANGE_END_USEC )
        	        printf "%.*f, %.3f\n", DECIMAL_DIGITS, $1, usecLat

	}
}