summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2023-02-08 22:08:43 +0100
committerJoel Rosdahl <joel@rosdahl.net>2023-02-08 22:24:00 +0100
commitb59f21d608e4f7d0a2d17965aa1f2f6fa7f643ff (patch)
tree65cd2f0045f37d38b9d8c4e627c68b3f7cea2c8c
parentd45a55885c3437baa836a35224d8881f8bbff57a (diff)
downloadccache-b59f21d608e4f7d0a2d17965aa1f2f6fa7f643ff.tar.gz
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.
-rw-r--r--src/storage/local/LocalStorage.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/storage/local/LocalStorage.cpp b/src/storage/local/LocalStorage.cpp
index 5134c0b7..3e30fe8c 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;