diff options
| author | Stefan Boberg <[email protected]> | 2024-12-16 15:37:47 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-16 15:37:47 +0100 |
| commit | 0cf7291ee2c4ae7461b4dcc082fb3778532e3df3 (patch) | |
| tree | 7735061b5c242a34baea0b4497cbb9381efe76b3 /src/zenstore/gc.cpp | |
| parent | 5.5.16 (diff) | |
| download | zen-0cf7291ee2c4ae7461b4dcc082fb3778532e3df3.tar.xz zen-0cf7291ee2c4ae7461b4dcc082fb3778532e3df3.zip | |
more memory tagging and fixes (#263)
This change adds more instrumentation for memory tracking, so that as little as possible comes through as Unknown in Insights analysis.
Diffstat (limited to 'src/zenstore/gc.cpp')
| -rw-r--r-- | src/zenstore/gc.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp index 9534d93f5..50588b8c0 100644 --- a/src/zenstore/gc.cpp +++ b/src/zenstore/gc.cpp @@ -741,6 +741,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) std::pair<std::string, GcReferencerStats>* Stats = &Result.ReferencerStats[Index]; WorkLeft.AddCount(1); PreCachePhaseThreadPool.ScheduleWork([this, &Ctx, &WorkLeft, Owner, Stats, &StoreCompactorsLock, &StoreCompactors]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); try { @@ -810,6 +812,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) WorkLeft.AddCount(1); PreCachePhaseThreadPool.ScheduleWork( [this, &Ctx, ReferenceStore, Stats, Index, &WorkLeft, &ReferencePrunersLock, &ReferencePruners]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); try { @@ -883,6 +887,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) WorkLeft.AddCount(1); PreCachePhaseThreadPool.ScheduleWork( [this, &Ctx, &WorkLeft, Referencer, Index, Stats, &ReferenceCheckersLock, &ReferenceCheckers]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); // The Referencer will create a reference checker that guarantees that the references do not change // as long as it lives @@ -965,6 +971,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) ReferemcerStats, &ReferenceValidatorsLock, &ReferenceValidators]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); std::vector<GcReferenceValidator*> Validators; try @@ -1038,6 +1046,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) std::pair<std::string, GcReferencerStats>* Stats = &Result.ReferencerStats[Index]; WorkLeft.AddCount(1); PreCachePhaseThreadPool.ScheduleWork([this, &Ctx, Checker, Index, Stats, &WorkLeft]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); try { @@ -1123,6 +1133,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) std::pair<std::string, GcReferencerStats>* Stats = &Result.ReferencerStats[Index]; WorkLeft.AddCount(1); LockedPhaseThreadPool.ScheduleWork([this, &Ctx, Checker, Index, Stats, &WorkLeft]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); try { @@ -1197,6 +1209,8 @@ GcManager::CollectGarbage(const GcSettings& Settings) WorkLeft.AddCount(1); LockedPhaseThreadPool.ScheduleWork( [this, &Ctx, Pruner, Stats, &WorkLeft, &GetUnusedReferences, &StoreCompactorsLock, &StoreCompactors]() { + ZEN_MEMSCOPE(GetGcTag()); + auto _ = MakeGuard([&WorkLeft]() { WorkLeft.CountDown(); }); // Go through all the ReferenceCheckers to see if the list of Cids the collector selected are // referenced or not. @@ -2331,6 +2345,8 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime, bool EnableValidation, bool SilenceErrors) { + ZEN_MEMSCOPE(GetGcTag()); + ZEN_TRACE_CPU("GcScheduler::CollectGarbage"); try |