aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/gc.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-23 15:23:25 +0200
committerGitHub <[email protected]>2023-10-23 15:23:25 +0200
commit54d0430a4507a7c1769a1587b7fc8049c7a3e575 (patch)
tree071a1804814688bc49e1ac2ad2aaddd2d1490b45 /src/zenstore/gc.cpp
parentRemove any unreferenced blocks in block store on open (#492) (diff)
downloadzen-54d0430a4507a7c1769a1587b7fc8049c7a3e575.tar.xz
zen-54d0430a4507a7c1769a1587b7fc8049c7a3e575.zip
fix m_LastFullGcDuration, m_LastFullGCDiff, m_LastFullGcDuration and m_LastLightweightGcDuration stats (#494)
Diffstat (limited to 'src/zenstore/gc.cpp')
-rw-r--r--src/zenstore/gc.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp
index 7396fcf65..24b7b4d2c 100644
--- a/src/zenstore/gc.cpp
+++ b/src/zenstore/gc.cpp
@@ -729,10 +729,12 @@ GcScheduler::GetState() const
{
std::unique_lock Lock(m_GcMutex);
- Result.LastFullGcTime = m_LastGcTime;
- Result.LastFullGCDiff = m_LastFullGCDiff;
- Result.LastLightweightGcTime = m_LastLightweightGcTime;
- Result.LastLightweightGCDiff = m_LastLightweightGCDiff;
+ Result.LastFullGcTime = m_LastGcTime;
+ Result.LastFullGCDiff = m_LastFullGCDiff;
+ Result.LastFullGcDuration = m_LastFullGcDuration;
+ Result.LastLightweightGcTime = m_LastLightweightGcTime;
+ Result.LastLightweightGCDiff = m_LastLightweightGCDiff;
+ Result.LastLightweightGcDuration = m_LastLightweightGcDuration;
}
std::error_code Ec;
DiskSpace Space = DiskSpaceInfo(Result.Config.RootDirectory, Ec);
@@ -1194,22 +1196,13 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime,
GcStorageSize Diff = m_GcManager.CollectGarbage(GcCtx);
+ std::chrono::milliseconds ElapsedMS = std::chrono::milliseconds(Timer.GetElapsedTimeMs());
+
if (SkipCid)
{
- m_LastLightweightGcTime = GcClock::Now();
-
- std::chrono::seconds ElapsedSeconds =
- std::chrono::duration_cast<std::chrono::seconds>(std::chrono::milliseconds(Timer.GetElapsedTimeMs()));
- if (SkipCid)
- {
- m_LastLightweightGcDuration = ElapsedSeconds;
- m_LastLightweightGCDiff = Diff;
- }
- else
- {
- m_LastFullGcDuration = ElapsedSeconds;
- m_LastFullGCDiff = Diff;
- }
+ m_LastLightweightGcTime = GcClock::Now();
+ m_LastLightweightGcDuration = ElapsedMS;
+ m_LastLightweightGCDiff = Diff;
}
else
{
@@ -1223,6 +1216,8 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime,
m_LastGcTime = GcClock::Now();
m_LastLightweightGcTime = m_LastGcTime;
+ m_LastFullGcDuration = ElapsedMS;
+ m_LastFullGCDiff = Diff;
}
try