]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add comments about the stats files
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 19:58:58 +0000 (20:58 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 21 Feb 2010 19:58:58 +0000 (20:58 +0100)
ccache.c
stats.c

index a925e23dab28b3961ceac3afb635bd1fbce8a5fb..e79fa67cec6fd40cca06c22568d68474435751f9 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -125,7 +125,10 @@ static int direct_i_file;
 /* the name of the cpp stderr file */
 static char *cpp_stderr;
 
-/* the name of the statistics file */
+/*
+ * Full path to the statistics file in the subdirectory where the cached result
+ * belongs (CCACHE_DIR/X/stats).
+ */
 char *stats_file = NULL;
 
 /* can we safely use the unification hashing backend? */
diff --git a/stats.c b/stats.c
index 6cb424d4d3b0c0cbe22758f877b54743784e4761..9114484127f0a8fca1320c64ba017a987e2a7999 100644 (file)
--- a/stats.c
+++ b/stats.c
@@ -136,6 +136,11 @@ static void stats_update_size(enum stats stat, size_t size)
        if (getenv("CCACHE_NOSTATS")) return;
 
        if (!stats_file) {
+               /*
+                * A NULL stats file means that we didn't get past find_hash(),
+                * so we update the counter in the cache-wide statistics file
+                * CCACHE_DIR/stats instead of a subdirectory stats file.
+                */
                if (!cache_dir) return;
                x_asprintf(&stats_file, "%s/stats", cache_dir);
        }