From: Joel Rosdahl Date: Sat, 5 Nov 2022 11:43:03 +0000 (+0100) Subject: chore: Improve inode cache logging X-Git-Tag: v4.7.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf2c2cc69542be61e1d732db9dcec8a079fdfff8;p=thirdparty%2Fccache.git chore: Improve inode cache logging - Only log inode cache hits/misses in debug mode. - Always log accumulated inode statistics at program exit. --- diff --git a/src/InodeCache.cpp b/src/InodeCache.cpp index 5985cd5b6..7c98f47fa 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; }