diff --git a/velox/common/caching/SsdFile.cpp b/velox/common/caching/SsdFile.cpp index b4b7c37fa431..e977f610ebe3 100644 --- a/velox/common/caching/SsdFile.cpp +++ b/velox/common/caching/SsdFile.cpp @@ -347,6 +347,7 @@ bool SsdFile::growOrEvictLocked() { logEviction(candidates); clearRegionEntriesLocked(candidates); + stats_.regionsEvicted += candidates.size(); writableRegions_ = std::move(candidates); suspended_ = false; return true; @@ -532,6 +533,7 @@ void SsdFile::updateStats(SsdCacheStats& stats) const { } stats.entriesAgedOut += stats_.entriesAgedOut; stats.regionsAgedOut += stats_.regionsAgedOut; + stats.regionsEvicted += stats_.regionsEvicted; for (auto pins : regionPins_) { stats.numPins += pins; } diff --git a/velox/common/caching/SsdFile.h b/velox/common/caching/SsdFile.h index 8502a9d649a7..9b027cf9cb60 100644 --- a/velox/common/caching/SsdFile.h +++ b/velox/common/caching/SsdFile.h @@ -138,6 +138,7 @@ struct SsdCacheStats { bytesCached = tsanAtomicValue(other.bytesCached); entriesAgedOut = tsanAtomicValue(other.entriesAgedOut); regionsAgedOut = tsanAtomicValue(other.regionsAgedOut); + regionsEvicted = tsanAtomicValue(other.regionsEvicted); numPins = tsanAtomicValue(other.numPins); openFileErrors = tsanAtomicValue(other.openFileErrors); @@ -162,6 +163,7 @@ struct SsdCacheStats { tsan_atomic bytesCached{0}; tsan_atomic entriesAgedOut{0}; tsan_atomic regionsAgedOut{0}; + tsan_atomic regionsEvicted{0}; tsan_atomic numPins{0}; tsan_atomic openFileErrors{0};