diff options
| author | Dan Engelbrecht <[email protected]> | 2023-11-28 07:54:05 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-28 13:54:05 +0100 |
| commit | dcaeaac4ebc6255cb210ce54a18b1cd01b9eeaf8 (patch) | |
| tree | 766d03bad3262643653dcd08a20e0dbad57e2f01 /src/zenstore | |
| parent | Don't call spdlog::drop_all, spdlog::shutdown will do that for us in a contro... (diff) | |
| download | zen-dcaeaac4ebc6255cb210ce54a18b1cd01b9eeaf8.tar.xz zen-dcaeaac4ebc6255cb210ce54a18b1cd01b9eeaf8.zip | |
tracing for gcv2 (#574)
- Improvement: Added more trace scopes for GCv2
- Bugfix: Make sure we can override flags to "false" when running `zen gc` commmand
- `smallobjects`, `skipcid`, `skipdelete`, `verbose`
Diffstat (limited to 'src/zenstore')
| -rw-r--r-- | src/zenstore/compactcas.cpp | 6 | ||||
| -rw-r--r-- | src/zenstore/filecas.cpp | 6 | ||||
| -rw-r--r-- | src/zenstore/gc.cpp | 12 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index c4f9ff2c6..e9a0a437b 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -560,6 +560,8 @@ public: virtual void CompactStore(GcCtx& Ctx, GcCompactStoreStats& Stats, const std::function<uint64_t()>& ClaimDiskReserveCallback) override { + ZEN_TRACE_CPU("CasContainer::CompactStore"); + Stopwatch Timer; const auto _ = MakeGuard([&] { if (!Ctx.Settings.Verbose) @@ -701,6 +703,8 @@ public: virtual GcStoreCompactor* RemoveUnreferencedData(GcCtx& Ctx, GcStats& Stats, const GetUnusedReferencesFunc& GetUnusedReferences) { + ZEN_TRACE_CPU("CasContainer::RemoveUnreferencedData"); + Stopwatch Timer; const auto _ = MakeGuard([&] { if (!Ctx.Settings.Verbose) @@ -780,6 +784,8 @@ CasContainerStrategy::GetGcName(GcCtx&) GcReferencePruner* CasContainerStrategy::CreateReferencePruner(GcCtx& Ctx, GcReferenceStoreStats&) { + ZEN_TRACE_CPU("CasContainer::CreateReferencePruner"); + Stopwatch Timer; const auto _ = MakeGuard([&] { if (!Ctx.Settings.Verbose) diff --git a/src/zenstore/filecas.cpp b/src/zenstore/filecas.cpp index bf12a0c1a..aeca01dd1 100644 --- a/src/zenstore/filecas.cpp +++ b/src/zenstore/filecas.cpp @@ -1355,6 +1355,8 @@ public: virtual void CompactStore(GcCtx& Ctx, GcCompactStoreStats& Stats, const std::function<uint64_t()>&) { + ZEN_TRACE_CPU("FileCas::CompactStore"); + Stopwatch Timer; const auto _ = MakeGuard([&] { Reset(m_ReferencesToClean); @@ -1451,6 +1453,8 @@ public: virtual GcStoreCompactor* RemoveUnreferencedData(GcCtx& Ctx, GcStats& Stats, const GetUnusedReferencesFunc& GetUnusedReferences) { + ZEN_TRACE_CPU("FileCas::RemoveUnreferencedData"); + Stopwatch Timer; const auto _ = MakeGuard([&] { if (!Ctx.Settings.Verbose) @@ -1523,6 +1527,8 @@ FileCasStrategy::GetGcName(GcCtx&) GcReferencePruner* FileCasStrategy::CreateReferencePruner(GcCtx& Ctx, GcReferenceStoreStats&) { + ZEN_TRACE_CPU("FileCas::CreateReferencePruner"); + Stopwatch Timer; const auto _ = MakeGuard([&] { if (!Ctx.Settings.Verbose) diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index 262c94feb..b53ca4bab 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -599,7 +599,7 @@ GcManager::RemoveGcReferenceStore(GcReferenceStore& ReferenceStore) GcResult GcManager::CollectGarbage(const GcSettings& Settings) { - ZEN_TRACE_CPU("Gc::CollectGarbage(v2)"); + ZEN_TRACE_CPU("GcV2::CollectGarbage"); GcCtx Ctx{.Settings = Settings, .IsCancelledFlag = m_CancelGC}; GcResult Result; @@ -630,6 +630,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) { return Sum(Result, true); } + ZEN_TRACE_CPU("GcV2::RemoveExpiredData"); Latch WorkLeft(1); { @@ -681,6 +682,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) std::unordered_map<size_t, std::unique_ptr<GcReferencePruner>> ReferencePruners; if (!m_GcReferenceStores.empty()) { + ZEN_TRACE_CPU("GcV2::CreateReferencePruners"); + ReferencePruners.reserve(m_GcReferenceStores.size()); Latch WorkLeft(1); RwLock ReferencePrunersLock; @@ -740,6 +743,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) std::unordered_map<std::unique_ptr<GcReferenceChecker>, size_t> ReferenceCheckers; if (!m_GcReferencers.empty()) { + ZEN_TRACE_CPU("GcV2::CreateReferenceCheckers"); + ReferenceCheckers.reserve(m_GcReferencers.size()); Latch WorkLeft(1); RwLock ReferenceCheckersLock; @@ -813,6 +818,7 @@ GcManager::CollectGarbage(const GcSettings& Settings) { return Sum(Result, true); } + ZEN_TRACE_CPU("GcV2::LockState"); // Locking all references checkers so we have a steady state of which references are used // From this point we have blocked all writes to all References (DiskBucket/ProjectStore) until @@ -870,6 +876,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) // Ask stores to remove data that the ReferenceCheckers says are not referenced - this should be a lightweight // operation that only updates in-memory index, actual disk changes should be done by the ReferenceStoreCompactors + ZEN_TRACE_CPU("GcV2::RemoveUnreferencedData"); + Latch WorkLeft(1); { @@ -932,6 +940,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) return Sum(Result, true); } + ZEN_TRACE_CPU("GcV2::CompactStores"); + auto ClaimDiskReserve = [&]() -> uint64_t { if (!std::filesystem::is_regular_file(Settings.DiskReservePath)) { |