aboutsummaryrefslogtreecommitdiff
path: root/contrib/traceroute/mean.awk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/traceroute/mean.awk')
-rw-r--r--contrib/traceroute/mean.awk12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/traceroute/mean.awk b/contrib/traceroute/mean.awk
new file mode 100644
index 000000000000..2d5e37820694
--- /dev/null
+++ b/contrib/traceroute/mean.awk
@@ -0,0 +1,12 @@
+/^ *[0-9]/ {
+ # print out the average time to each hop along a route.
+ tottime = 0; n = 0;
+ for (f = 5; f <= NF; ++f) {
+ if ($f == "ms") {
+ tottime += $(f - 1)
+ ++n
+ }
+ }
+ if (n > 0)
+ print $1, tottime/n, median
+}