Annotation of 43BSDReno/usr.sbin/traceroute/mean.awk, revision 1.1.1.1

1.1       root        1: #!/bin/awk -f
                      2: #
                      3: # Copyright (c) 1990 The Regents of the University of California.
                      4: # All rights reserved.
                      5: #
                      6: # This code is derived from software contributed to Berkeley by
                      7: # Van Jacobson.
                      8: #
                      9: # Redistribution and use in source and binary forms are permitted
                     10: # provided that the above copyright notice and this paragraph are
                     11: # duplicated in all such forms and that any documentation,
                     12: # advertising materials, and other materials related to such
                     13: # distribution and use acknowledge that the software was developed
                     14: # by the University of California, Berkeley.  The name of the
                     15: # University may not be used to endorse or promote products derived
                     16: # from this software without specific prior written permission.
                     17: # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     18: # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     19: # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     20: #
                     21: #      @(#)mean.awk    5.2 (Berkeley) 4/28/90
                     22: #
                     23: /^ *[0-9]/     {
                     24:        # print out the average time to each hop along a route.
                     25:        tottime = 0; n = 0;
                     26:        for (f = 5; f <= NF; ++f) {
                     27:                if ($f == "ms") {
                     28:                        tottime += $(f - 1)
                     29:                        ++n
                     30:                }
                     31:        }
                     32:        if (n > 0)
                     33:                print $1, tottime/n, median
                     34: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.