diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2022-11-05 12:43:03 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2022-11-05 12:45:36 +0100 |
commit | bf2c2cc69542be61e1d732db9dcec8a079fdfff8 (patch) | |
tree | 33537ff6a7520d3236f4b9f4d180268ad02cee44 | |
parent | 84c58a57e020174d0d4098a620cba03c3c0284c6 (diff) | |
download | ccache-bf2c2cc69542be61e1d732db9dcec8a079fdfff8.tar.gz |
chore: Improve inode cache logging
- Only log inode cache hits/misses in debug mode.
- Always log accumulated inode statistics at program exit.
-rw-r--r-- | src/InodeCache.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/InodeCache.cpp b/src/InodeCache.cpp index 5985cd5b..7c98f47f 100644 --- a/src/InodeCache.cpp +++ b/src/InodeCache.cpp @@ -382,6 +382,10 @@ InodeCache::InodeCache(const Config& config) : m_config(config) InodeCache::~InodeCache() { if (m_sr) { + LOG("Accumulated stats for inode cache: hits={}, misses={}, errors={}", + m_sr->hits.load(), + m_sr->misses.load(), + m_sr->errors.load()); munmap(m_sr, sizeof(SharedRegion)); } } @@ -430,18 +434,13 @@ InodeCache::get(const std::string& path, return false; } - LOG("Inode cache {}: {}", found ? "hit" : "miss", path); - if (m_config.debug()) { + LOG("Inode cache {}: {}", found ? "hit" : "miss", path); if (found) { ++m_sr->hits; } else { ++m_sr->misses; } - LOG("Accumulated stats for inode cache: hits={}, misses={}, errors={}", - m_sr->hits.load(), - m_sr->misses.load(), - m_sr->errors.load()); } return found; } |