File: gen1.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 (31 lines) | stat: -rwxr-xr-x 647 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
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/awk -f

BEGIN {
	print "# ==== playback file for sockperf - generated by gen1.awk ===="

	PPS = 200*1000
	NUM_RECORDS = PPS # 30*1000

	runtime = NUM_RECORDS/PPS
	interval = 1/PPS
	baseTime = 1	
	
	printf "#baseTime=%f; PPS=%d; runtime=%f; interval=%lf; NUM_RECORDS=%d\n", baseTime, PPS, runtime, interval, NUM_RECORDS
	
	deltaSize = 0
	minSize = 12
	maxSize = 50000 - minSize
	
	t = baseTime
	s = 0
	
	printf "# file contains %d records\n", NUM_RECORDS
	
	for (i = 0; i < NUM_RECORDS; i++) {
		t += interval
		s += deltaSize
		printf("%.9lf, %d\n", t, minSize+s%maxSize)
	}

	printf "#%d records were written successfuly\n", NUM_RECORDS
}