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/gc.cpp | |
| 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/gc.cpp')
| -rw-r--r-- | src/zenstore/gc.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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)) { |