mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
compiler/write_deps_file.m:
Move the filename creation code to the end of the file. Expand it
with conditionally-enabled code that gathers statistics about the
hit rate of the file name cache for each extension, and document
its result, which validates the existing approach.
Document an approach that looks like would speed up the file name
creation process, but does not.
compiler/mercury_compile_main.m:
Call a new predicate in write_deps_file.m to dump out the statistics
it gathered, if there are any.
tools/write_deps_file_stats:
A new script to summarize the raw data dumped out by write_deps_file.m.
library/dir.m:
Improve indentation.
43 lines
1.4 KiB
Awk
Executable File
43 lines
1.4 KiB
Awk
Executable File
#!/usr/bin/awk -f
|
|
# vim: ft=awk ts=4 sw=4 et
|
|
#
|
|
# This script summarizes the contents of the WRITE_DEPS_FILE_CACHE_STATS
|
|
# files generated by the conditionally-enabled statistics-gathering code
|
|
# at the end of compiler/write_deps_file.m.
|
|
#
|
|
|
|
NF == 3 {
|
|
ext = $1;
|
|
cur_lookups = $2;
|
|
cur_misses = $3;
|
|
cur_hits = cur_lookups - cur_misses;
|
|
|
|
executions[ext] += 1;
|
|
lookups[ext] += cur_lookups;
|
|
hits[ext] += cur_hits;
|
|
misses[ext] += cur_misses;
|
|
|
|
overall_lookups += cur_lookups;
|
|
overall_hits += cur_hits;
|
|
overall_misses += cur_misses;
|
|
# printf "EXEC %s %d\n", ext, executions[ext];
|
|
}
|
|
END {
|
|
overall_hits = overall_lookups - overall_misses;
|
|
overall_hit_rate = (100 * overall_hits) / overall_lookups;
|
|
printf "number of lookups: %12d\n", overall_lookups;
|
|
printf "number of hits: %12d\n", overall_hits;
|
|
printf "number of misses: %12d\n", overall_misses;
|
|
printf "hit %: %6.2f\n\n", overall_hit_rate;
|
|
|
|
printf "----------------------------------------------------------\n\n";
|
|
|
|
printf "%-56s %5s %7s %5s\n\n",
|
|
"extension", "#exec", "#lookup", "hit%";
|
|
for (ext in executions) {
|
|
hit_rate[ext] = (100 * hits[ext]) / lookups[ext];
|
|
printf "%-56s %5d %7d %5.2f\n",
|
|
ext, executions[ext], lookups[ext], hit_rate[ext];
|
|
}
|
|
}
|