mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
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.
22 lines
422 B
Awk
Executable File
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]);
|
|
}
|
|
}
|