Files
mercury/tools/make_deps_cache_stats
Zoltan Somogyi baf1395d7d Disable the two new caches in make.deps_cache.m.
They turned out to have a zero hit rate, making them useless.

compiler/make.dependencies.m:
    Add code to use the two new caches, indirect_imports_non_intermod
    and anc0_dir1_indir2_non_intermod. I got statistics on their
    performance while they were enabled, but since their hit rate was zero,
    this diff includes them only in a commented-out form.

    Note that adding the second cache required adding a new dep_spec,
    which remains, since it shouldn't affect performance at all.

compiler/make.deps_cache.m:
    Disable the those two caches.

    Fix an issue where the original statistics-gathering code
    mixed up hits and misses.

    Include the statistics gathered in course of implementing this diff.

tools/make_deps_cache_stats:
    Update this script to fix the hit/miss issue, and to print more info.
2023-10-16 16:03:06 +11:00

44 lines
1.5 KiB
Awk
Executable File

#!/usr/bin/awk -f
# vim: ft=awk ts=4 sw=4 et
#
# This script summarizes the contents of the MAKE_DEPS_CACHE_STATS
# files generated by the conditionally-enabled statistics-gathering code
# at the end of compiler/make.deps_cache.m.
#
NF == 3 {
cache = $1;
cur_lookups = $2;
cur_misses = $3;
cur_hits = cur_lookups - cur_misses;
caches[cache] += 1;
lookups[cache] += cur_lookups;
misses[cache] += cur_misses;
hits[cache] += cur_hits;
overall_lookups += cur_lookups;
overall_hits += cur_hits;
overall_misses += cur_misses;
# printf "EXEC %s %d\n", cache, caches[cache];
}
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 "%-30s %6s %8s %8s %8s %6s\n\n",
"cache", "#exec", "#lookup", "#hit", "#miss", "hit%";
for (cache in caches) {
hit_rate[cache] = (100 * hits[cache]) / lookups[cache];
printf "%-30s %6d %8d %8d %8d %6.2f\n",
cache, caches[cache], lookups[cache],
hits[cache], misses[cache], hit_rate[cache];
}
}