From bf2c2cc69542be61e1d732db9dcec8a079fdfff8 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 5 Nov 2022 12:43:03 +0100 Subject: [PATCH] chore: Improve inode cache logging - Only log inode cache hits/misses in debug mode. - Always log accumulated inode statistics at program exit. --- src/InodeCache.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; } -- 2.47.3