From 0599d52d80beb85e50ffe1f56c8434376a8c08a2 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 2 May 2022 16:50:08 +0200 Subject: simplify lambda captures --- zenstore/blockstore.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'zenstore/blockstore.cpp') diff --git a/zenstore/blockstore.cpp b/zenstore/blockstore.cpp index 178687b5f..e502113fc 100644 --- a/zenstore/blockstore.cpp +++ b/zenstore/blockstore.cpp @@ -292,17 +292,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, uint64_t DeletedCount = 0; Stopwatch TotalTimer; - const auto _ = MakeGuard([this, - &TotalTimer, - &WriteBlockTimeUs, - &WriteBlockLongestTimeUs, - &ReadBlockTimeUs, - &ReadBlockLongestTimeUs, - &TotalChunkCount, - &DeletedCount, - &MovedCount, - &DeletedSize, - OldTotalSize] { + const auto _ = MakeGuard([&] { ZEN_INFO( "reclaim space for '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted #{} and moved " "#{} " @@ -414,7 +404,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, { RwLock::SharedLockScope _i(m_InsertLock); Stopwatch Timer; - const auto __ = MakeGuard([&Timer, &WriteBlockTimeUs, &WriteBlockLongestTimeUs] { + const auto __ = MakeGuard([&] { uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); WriteBlockTimeUs += ElapsedUs; WriteBlockLongestTimeUs = std::max(ElapsedUs, WriteBlockLongestTimeUs); @@ -436,7 +426,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, { RwLock::ExclusiveLockScope _i(m_InsertLock); Stopwatch Timer; - const auto __ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] { + const auto __ = MakeGuard([&] { uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); ReadBlockTimeUs += ElapsedUs; ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs); @@ -476,7 +466,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, MovedChunks.clear(); RwLock::ExclusiveLockScope __(m_InsertLock); Stopwatch Timer; - const auto ___ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] { + const auto ___ = MakeGuard([&] { uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); ReadBlockTimeUs += ElapsedUs; ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs); @@ -515,7 +505,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, NiceBytes(Space.Free + ReclaimedSpace)); RwLock::ExclusiveLockScope _l(m_InsertLock); Stopwatch Timer; - const auto __ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] { + const auto __ = MakeGuard([&] { uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); ReadBlockTimeUs += ElapsedUs; ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs); @@ -559,7 +549,7 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot, { RwLock::ExclusiveLockScope __(m_InsertLock); Stopwatch Timer; - const auto ___ = MakeGuard([&Timer, &ReadBlockTimeUs, &ReadBlockLongestTimeUs] { + const auto ___ = MakeGuard([&] { uint64_t ElapsedUs = Timer.GetElapsedTimeUs(); ReadBlockTimeUs += ElapsedUs; ReadBlockLongestTimeUs = std::max(ElapsedUs, ReadBlockLongestTimeUs); -- cgit v1.2.3