Files
mercury/tools/sum_stats
Zoltan Somogyi ecbe12cfa6 Provide a mechanism for gathering statistics about items.
compiler/prog_item_stats.m:
    New module to gather and print out statistics about items.

compiler/make_hlds_passes.m:
    Invoke the new module if this module was compiled with a trace flag
    that calls for this. (It is of course off by default.)

compiler/parse_tree.m:
    Include the new module.

compiler/notes/compiler_design.html:
    Document the new module, and improve the formatting of the documentation
    of related modules.

tools/item_stats:
    A new script to summarize the statistics gathered by prog_item_stats.m.

tools/sum_stats:
    A much earlier version of that script, which may be useful in other
    contexts.
2015-10-24 07:01:36 +11:00

22 lines
422 B
Awk
Executable File

#!/usr/bin/awk -f
# vim: ts=4 sw=4 et ft=awk
#
# Given input containing only lines of the form
#
# category count
#
# this script computes and prints the total count for each category.
{
if (NF == 2) {
cnt[$1] += $2;
} else {
printf("unexpected line: <%s>\n", $0);
}
}
END {
for (i in cnt) {
printf("%-30s %12d\n", i, cnt[i]);
}
}