1c0b746e5SOllivier Robert# program to scan peer_summary file and produce summary of daily summaries 2c0b746e5SOllivier Robert# 3c0b746e5SOllivier Robert# usage: awk -f psummary.awk peer_summary 4c0b746e5SOllivier Robert# 5c0b746e5SOllivier Robert# format of input records 6c0b746e5SOllivier Robert# peerstats.19960706 7c0b746e5SOllivier Robert# ident cnt mean rms max delay dist disp 8c0b746e5SOllivier Robert# ========================================================================== 9c0b746e5SOllivier Robert# 140.173.112.2 85 -0.509 1.345 4.606 80.417 49.260 1.092 10c0b746e5SOllivier Robert# 128.4.1.20 1364 0.058 0.364 4.465 3.712 10.540 1.101 11c0b746e5SOllivier Robert# ... 12c0b746e5SOllivier Robert# 13c0b746e5SOllivier Robert# format of output records (actual data from rackety.udel.edu) 14c0b746e5SOllivier Robert# host days mean rms max >1 >5 >10 >50 15c0b746e5SOllivier Robert# ================================================================== 16c0b746e5SOllivier Robert# 127.127.22.1 1090 0.001 0.401 99.800 19 14 13 10 17c0b746e5SOllivier Robert# 127.0.0.1 1188 0.060 1.622 105.004 78 65 51 32 18c0b746e5SOllivier Robert# 127.127.4.1 586 0.000 0.000 0.000 0 0 0 0 19c0b746e5SOllivier Robert# 140.173.64.1 975 -0.010 2.552 257.595 399 192 114 8 20c0b746e5SOllivier Robert# 128.175.1.3 1121 0.447 8.637 204.123 479 460 397 147 21c0b746e5SOllivier Robert# 140.173.16.1 1106 0.027 1.014 267.857 242 38 31 23 22c0b746e5SOllivier Robert# 128.4.1.4 1119 0.023 1.037 267.748 223 41 34 23 23c0b746e5SOllivier Robert# 128.4.1.2 850 1.202 1.654 267.704 196 53 45 34 24c0b746e5SOllivier Robert# 128.4.1.20 1101 0.088 1.139 268.322 430 111 83 16 25c0b746e5SOllivier Robert# 140.173.32.1 979 -0.949 2.344 257.671 396 217 136 7 26c0b746e5SOllivier Robert# 140.173.112.2 1066 0.040 2.111 152.969 442 315 152 16 27c0b746e5SOllivier Robert# 140.173.80.1 1059 0.019 1.858 87.690 438 348 150 9 28c0b746e5SOllivier Robert# 140.173.96.1 1015 0.110 2.007 266.744 399 314 170 17 29c0b746e5SOllivier Robert# 140.173.128.1 1103 -0.002 2.600 257.672 465 262 132 13 30c0b746e5SOllivier Robert# 140.222.135.1 347 -4.626 8.804 196.394 135 135 134 95 31c0b746e5SOllivier Robert# 140.173.128.2 1081 -0.046 2.967 261.448 463 342 172 17 32c0b746e5SOllivier Robert# 140.222.141.1 354 0.820 8.809 195.333 142 141 139 100 33c0b746e5SOllivier Robert# 140.173.144.2 1058 -0.107 2.805 270.498 448 341 163 17 34c0b746e5SOllivier Robert# 140.222.134.1 354 -0.056 8.479 172.458 142 141 141 100 35c0b746e5SOllivier Robert# 140.222.144.1 415 -1.456 9.964 191.684 161 161 161 123 36c0b746e5SOllivier Robert# 140.222.136.1 234 0.902 7.707 182.431 62 62 62 48 37c0b746e5SOllivier Robert# 128.175.1.1 774 0.890 4.838 266.799 358 291 200 83 38c0b746e5SOllivier Robert# 127.127.10.1 1086 -0.002 1.462 231.128 240 239 60 57 39c0b746e5SOllivier Robert# 140.173.48.2 576 0.016 4.092 350.512 213 126 88 16 40c0b746e5SOllivier Robert# 128.4.1.11 3 0.000 0.000 0.000 0 0 0 0 41c0b746e5SOllivier Robert# 128.4.1.26 386 -1.363 20.251 341.284 164 164 161 132 42c0b746e5SOllivier Robert# 43c0b746e5SOllivier Robert# select table beginning with "ident" 44c0b746e5SOllivier Robert{ 45c0b746e5SOllivier Robert if (NF < 8 || $1 == "ident") 46c0b746e5SOllivier Robert continue 47c0b746e5SOllivier Robert i = n 48c0b746e5SOllivier Robert for (j = 0; j < n; j++) { 49c0b746e5SOllivier Robert if ($1 == peer_ident[j]) 50c0b746e5SOllivier Robert i = j 51c0b746e5SOllivier Robert } 52c0b746e5SOllivier Robert if (i == n) { 53c0b746e5SOllivier Robert peer_ident[i] = $1 54c0b746e5SOllivier Robert n++ 55c0b746e5SOllivier Robert } 56c0b746e5SOllivier Robert peer_count[i]++ 57c0b746e5SOllivier Robert if (($7 - $6 / 2) < 400) { 58c0b746e5SOllivier Robert peer_count[i]++ 59c0b746e5SOllivier Robert peer_mean[i] += $3 60c0b746e5SOllivier Robert peer_var[i] += $4 * $4 61c0b746e5SOllivier Robert if ($5 > peer_max[i]) 62c0b746e5SOllivier Robert peer_max[i] = $5 63c0b746e5SOllivier Robert if ($5 > 1) 64c0b746e5SOllivier Robert peer_1[i]++ 65c0b746e5SOllivier Robert if ($5 > 5) 66c0b746e5SOllivier Robert peer_2[i]++ 67c0b746e5SOllivier Robert if ($5 > 10) 68c0b746e5SOllivier Robert peer_3[i]++ 69c0b746e5SOllivier Robert if ($5 > 50) 70c0b746e5SOllivier Robert peer_4[i]++ 71c0b746e5SOllivier Robert } 72c0b746e5SOllivier Robert} END { 73c0b746e5SOllivier Robert printf " host days mean rms max >1 >5 >10 >50\n" 74c0b746e5SOllivier Robert printf "==================================================================\n" 75c0b746e5SOllivier Robert for (i = 0; i < n; i++) { 76c0b746e5SOllivier Robert if (peer_count[i] <= 0) 77c0b746e5SOllivier Robert continue 78c0b746e5SOllivier Robert peer_mean[i] /= peer_count[i] 79c0b746e5SOllivier Robert peer_var[i] = sqrt(peer_var[i] / peer_count[i]) 80c0b746e5SOllivier Robert 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] 81c0b746e5SOllivier Robert } 82c0b746e5SOllivier Robert} 83