aboutsummaryrefslogtreecommitdiff
path: root/zenstore/gc.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-03-31 11:18:33 +0200
committerDan Engelbrecht <[email protected]>2022-03-31 11:29:28 +0200
commitd7331a809702551446496e1a0e86b9fcea42c0e3 (patch)
tree485e6bfdf4b76389f15fb7875c424822d5aac9e2 /zenstore/gc.cpp
parentDon hard fail on removing files we no longer care about (diff)
downloadzen-d7331a809702551446496e1a0e86b9fcea42c0e3.tar.xz
zen-d7331a809702551446496e1a0e86b9fcea42c0e3.zip
Improved GC logging
Diffstat (limited to 'zenstore/gc.cpp')
-rw-r--r--zenstore/gc.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/zenstore/gc.cpp b/zenstore/gc.cpp
index 0f430f61c..dee8c209f 100644
--- a/zenstore/gc.cpp
+++ b/zenstore/gc.cpp
@@ -8,6 +8,7 @@
#include <zencore/filesystem.h>
#include <zencore/fmtutils.h>
#include <zencore/logging.h>
+#include <zencore/scopeguard.h>
#include <zencore/string.h>
#include <zencore/testing.h>
#include <zencore/testutils.h>
@@ -262,10 +263,13 @@ CasGc::CollectGarbage(GcContext& GcCtx)
RwLock::SharedLockScope _(m_Lock);
// First gather reference set
-
- for (GcContributor* Contributor : m_GcContribs)
{
- Contributor->GatherReferences(GcCtx);
+ Stopwatch Timer;
+ const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("gathered references in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ for (GcContributor* Contributor : m_GcContribs)
+ {
+ Contributor->GatherReferences(GcCtx);
+ }
}
// Cache records reference CAS chunks with the uncompressed
@@ -300,15 +304,22 @@ CasGc::CollectGarbage(GcContext& GcCtx)
// Then trim storage
- for (GcStorage* Storage : m_GcStorage)
{
- Storage->CollectGarbage(GcCtx);
+ Stopwatch Timer;
+ const auto Guard = MakeGuard([this, &Timer] { ZEN_INFO("collected garbage in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
+ for (GcStorage* Storage : m_GcStorage)
+ {
+ Storage->CollectGarbage(GcCtx);
+ }
}
// Remove Cid to CAS hash mappings. Scrub?
if (CidStore* CidStore = m_CidStore)
{
+ Stopwatch Timer;
+ const auto Guard =
+ MakeGuard([this, &Timer] { ZEN_INFO("clean up deleted content ids in {}", NiceTimeSpanMs(Timer.GetElapsedTimeMs())); });
CidStore->RemoveCids(GcCtx.DeletedCas());
}
}