From a675bb35b79d6a661dcf7a5298da17faf13b2e16 Mon Sep 17 00:00:00 2001 From: kssenii Date: Fri, 13 Dec 2024 12:01:20 +0100 Subject: [PATCH] Add metric --- src/Interpreters/Cache/FileCache.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Interpreters/Cache/FileCache.cpp b/src/Interpreters/Cache/FileCache.cpp index ebdc03f7d06..91192b7ad58 100644 --- a/src/Interpreters/Cache/FileCache.cpp +++ b/src/Interpreters/Cache/FileCache.cpp @@ -247,7 +247,15 @@ CachePriorityGuard::Lock FileCache::lockCache() const CachePriorityGuard::Lock FileCache::tryLockCache(std::optional acquire_timeout) const { - return acquire_timeout.has_value() ? cache_guard.tryLockFor(acquire_timeout.value()) : cache_guard.tryLock(); + if (acquire_timeout.has_value()) + { + ProfileEventTimeIncrement watch(ProfileEvents::FilesystemCacheLockCacheMicroseconds); + return cache_guard.tryLockFor(acquire_timeout.value()); + } + else + { + return cache_guard.tryLock(); + } } FileSegments FileCache::getImpl(const LockedKey & locked_key, const FileSegment::Range & range, size_t file_segments_limit) const