aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-09-15 07:36:58 -0400
committerGitHub <[email protected]>2023-09-15 13:36:58 +0200
commit6163987f858597e92e68a61ed35be35bd4e7a552 (patch)
tree94e78c3865f7f288df041636f9471b5a1511792b /src/zenstore/compactcas.cpp
parentupdated CHANGELOG.md release versions (diff)
downloadzen-6163987f858597e92e68a61ed35be35bd4e7a552.tar.xz
zen-6163987f858597e92e68a61ed35be35bd4e7a552.zip
add more trace scopes (#362)
* more trace scopes * Make sure ReplayLogEntries uses the correct size for oplog buffer * changelog
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index fe31ad759..63158f6de 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -147,6 +147,7 @@ CasContainerStrategy::Initialize(const std::filesystem::path& RootDirectory,
CasStore::InsertResult
CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const IoHash& ChunkHash)
{
+ ZEN_TRACE_CPU("CasContainer::InsertChunk");
{
RwLock::SharedLockScope _(m_LocationMapLock);
if (m_LocationMap.contains(ChunkHash))
@@ -192,6 +193,8 @@ CasContainerStrategy::InsertChunk(IoBuffer Chunk, const IoHash& ChunkHash)
IoBuffer
CasContainerStrategy::FindChunk(const IoHash& ChunkHash)
{
+ ZEN_TRACE_CPU("CasContainer::FindChunk");
+
RwLock::SharedLockScope _(m_LocationMapLock);
auto KeyIt = m_LocationMap.find(ChunkHash);
if (KeyIt == m_LocationMap.end())
@@ -418,6 +421,8 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx)
LocationMap_t LocationMap;
BlockStore::ReclaimSnapshotState BlockStoreState;
{
+ ZEN_TRACE_CPU("CasContainer::CollectGarbage::State");
+
RwLock::SharedLockScope ___(m_LocationMapLock);
Stopwatch Timer;
const auto ____ = MakeGuard([&Timer, &WriteBlockTimeUs, &WriteBlockLongestTimeUs] {
@@ -445,19 +450,22 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx)
KeepChunkIndexes.reserve(TotalChunkCount);
ChunkIndexToChunkHash.reserve(TotalChunkCount);
- GcCtx.FilterCids(TotalChunkHashes, [&](const IoHash& ChunkHash, bool Keep) {
- auto KeyIt = LocationMap.find(ChunkHash);
- const BlockStoreDiskLocation& DiskLocation = KeyIt->second;
- BlockStoreLocation Location = DiskLocation.Get(m_PayloadAlignment);
- size_t ChunkIndex = ChunkLocations.size();
-
- ChunkLocations.push_back(Location);
- ChunkIndexToChunkHash[ChunkIndex] = ChunkHash;
- if (Keep)
- {
- KeepChunkIndexes.push_back(ChunkIndex);
- }
- });
+ {
+ ZEN_TRACE_CPU("CasContainer::CollectGarbage::Filter");
+ GcCtx.FilterCids(TotalChunkHashes, [&](const IoHash& ChunkHash, bool Keep) {
+ auto KeyIt = LocationMap.find(ChunkHash);
+ const BlockStoreDiskLocation& DiskLocation = KeyIt->second;
+ BlockStoreLocation Location = DiskLocation.Get(m_PayloadAlignment);
+ size_t ChunkIndex = ChunkLocations.size();
+
+ ChunkLocations.push_back(Location);
+ ChunkIndexToChunkHash[ChunkIndex] = ChunkHash;
+ if (Keep)
+ {
+ KeepChunkIndexes.push_back(ChunkIndex);
+ }
+ });
+ }
const bool PerformDelete = GcCtx.IsDeletionMode() && GcCtx.CollectSmallObjects();
if (!PerformDelete)