#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
#
# Given a file generated by frame_sizes as its input, which has one line per
# procedure and gives the stack frame size of that procedure, this script
# computes and prints the average frame size.
    {
        if (NF != 5) {
            printf "error: NF != 5\n"
            printf "%s\n", $0;
            next;
        }

        proc = $3 " " $4 " " $5;
        framesize = $2;

        frames += 1;
        sizes += framesize;
    }
END {
        printf "number of procedures with frames:   %d\n", frames;
        printf "average number of words per frame: %5.2f\n", sizes / frames;
    }
