]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
perf: Don't update stats file when there are no incremented counters
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 8 Feb 2023 21:08:43 +0000 (22:08 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 8 Feb 2023 21:24:00 +0000 (22:24 +0100)
This can happen for instance when ccache is about to exit with a fatal
error.

src/storage/local/LocalStorage.cpp

index 5134c0b7f47189908008c67a2f291dea05523925..3e30fe8ce29a40ee5f7e27c424d14a10d6e59080 100644 (file)
@@ -340,7 +340,7 @@ LocalStorage::LocalStorage(const Config& config) : m_config(config)
 void
 LocalStorage::finalize()
 {
-  if (m_config.stats()) {
+  if (m_config.stats() && !m_counter_updates.all_zero()) {
     // Pseudo-randomly choose one of the stats files in the 256 level 2
     // directories.
     const auto bucket = getpid() % 256;