diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2018-01-04 22:55:58 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2018-01-10 20:58:32 +0100 |
commit | e53191d60e6d6bf90fac4753152b10ef4386938d (patch) | |
tree | f8a160179e9e9a5bf69c0164f5534bde9fdf2cac | |
parent | c12dd9228c852ba95c20df834fe6013a71c0acaf (diff) | |
download | ccache-e53191d60e6d6bf90fac4753152b10ef4386938d.tar.gz |
cleanup: Improve logging
-rw-r--r-- | cleanup.c | 5 | ||||
-rw-r--r-- | stats.c | 17 |
2 files changed, 17 insertions, 5 deletions
@@ -1,5 +1,5 @@ // Copyright (C) 2002-2006 Andrew Tridgell -// Copyright (C) 2009-2016 Joel Rosdahl +// Copyright (C) 2009-2018 Joel Rosdahl // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free @@ -194,6 +194,9 @@ cleanup_dir(struct conf *conf, const char *dir) stats_add_cleanup(dir, 1); } + cc_log("After cleanup: %lu KiB, %zu files", + (unsigned long)cache_size / 1024, + files_in_cache); stats_set_sizes(dir, files_in_cache, cache_size); // Free it up. @@ -1,5 +1,5 @@ // Copyright (C) 2002-2004 Andrew Tridgell -// Copyright (C) 2009-2016 Joel Rosdahl +// Copyright (C) 2009-2018 Joel Rosdahl // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free @@ -374,22 +374,31 @@ stats_flush(void) } } + char *subdir = dirname(stats_file); bool need_cleanup = false; + if (conf->max_files != 0 && counters->data[STATS_NUMFILES] > conf->max_files / 16) { + cc_log("Need to clean up %s since it holds %u files (limit: %u files)", + subdir, + counters->data[STATS_NUMFILES], + conf->max_files / 16); need_cleanup = true; } if (conf->max_size != 0 && counters->data[STATS_TOTALSIZE] > conf->max_size / 1024 / 16) { + cc_log("Need to clean up %s since it holds %u KiB (limit: %lu KiB)", + subdir, + counters->data[STATS_TOTALSIZE], + (unsigned long)conf->max_size / 1024 / 16); need_cleanup = true; } if (need_cleanup) { - char *p = dirname(stats_file); - cleanup_dir(conf, p); - free(p); + cleanup_dir(conf, subdir); } + free(subdir); counters_free(counters); } |