From: Joel Rosdahl Date: Wed, 8 Feb 2023 21:08:43 +0000 (+0100) Subject: perf: Don't update stats file when there are no incremented counters X-Git-Tag: v4.8~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b59f21d608e4f7d0a2d17965aa1f2f6fa7f643ff;p=thirdparty%2Fccache.git perf: Don't update stats file when there are no incremented counters This can happen for instance when ccache is about to exit with a fatal error. --- diff --git a/src/storage/local/LocalStorage.cpp b/src/storage/local/LocalStorage.cpp index 5134c0b7f..3e30fe8ce 100644 --- a/src/storage/local/LocalStorage.cpp +++ b/src/storage/local/LocalStorage.cpp @@ -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;