diff options
| author | Dan Engelbrecht <[email protected]> | 2022-05-02 16:50:08 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-05-02 16:50:08 +0200 |
| commit | 0599d52d80beb85e50ffe1f56c8434376a8c08a2 (patch) | |
| tree | 9c27adbe6bbbcd79d0153c6167cd385f0ded98e3 /zenstore/blockstore.cpp | |
| parent | Refactor WriteChunk to not need callback (diff) | |
| download | zen-0599d52d80beb85e50ffe1f56c8434376a8c08a2.tar.xz zen-0599d52d80beb85e50ffe1f56c8434376a8c08a2.zip | |
simplify lambda captures
Diffstat (limited to 'zenstore/blockstore.cpp')
| -rw-r--r-- | zenstore/blockstore.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
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); |