aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd/scripts/stats/rms.awk
blob: 34d612ab35821ab9b454476866651a80da354dbc (plain) (blame)
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
# program to scan peer_summary file
#
{
	if (NF < 8 || $1 == "ident")
		continue
	i = n
	for (j = 0; j < n; j++) {
		if ($1 == peer_ident[j])
			i = j
	}
	if (i == n) {
		peer_ident[i] = $1
		n++
	}
	peer_count[i]++
	if (($7 - $6 / 2) < 400) {
		peer_count[i]++
		peer_mean[i] += $3
		peer_var[i] += $4 * $4
		if ($5 > peer_max[i])
			peer_max[i] = $5
		if ($5 > 1)
			peer_1[i]++
		if ($5 > 5)
			peer_2[i]++
		if ($5 > 10)
			peer_3[i]++
		if ($5 > 50)
			peer_4[i]++
	}
} END {
	printf "       host     cnt     mean        sd       max   >1  >5 >10 >50\n"
	printf "=================================================================\n"
	for (i = 0; i < n; i++) {
		if (peer_count[i] <= 0)
			continue
		peer_mean[i] /= peer_count[i]
		peer_var[i] = sqrt(peer_var[i] / peer_count[i])
		printf "%15s%4d%10.3f%10.3f%10.3f%4d%4d%4d%4d\n", peer_ident[i], peer_count[i], peer_mean[i], peer_var[i], peer_max[i], peer_1[i], peer_2[i], peer_3[i], peer_4[i]
	}
}