diff options
| author | Dan Engelbrecht <[email protected]> | 2025-10-24 13:22:40 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-24 13:22:40 +0200 |
| commit | df0f7641a5df77e4b5e00ef63458d38c8527597c (patch) | |
| tree | fd9a62f65a6f0cc74f12232cd31ab890228f8283 /src | |
| parent | gracefully handle broken gc dlog (#606) (diff) | |
| download | zen-df0f7641a5df77e4b5e00ef63458d38c8527597c.tar.xz zen-df0f7641a5df77e4b5e00ef63458d38c8527597c.zip | |
fixed progress bar when scanning changed local files (#608)
* fixed progress bar when scanning changed local files
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 51 | ||||
| -rw-r--r-- | src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h | 12 |
2 files changed, 40 insertions, 23 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 143f567af..c5b9c4d70 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -1805,33 +1805,36 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; ChunkedFolderContent UpdatedLocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, UpdatedContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), UpdatedContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = ByteCountToScan - ChunkingStats.BytesHashed.load(), + .RemainingCount = ByteCountToScan - LocalChunkingStats.BytesHashed.load(), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); + ChunkingStats += LocalChunkingStats; + FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (AbortFlag) @@ -1906,33 +1909,34 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; ChunkedFolderContent UpdatedLocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, UpdatedContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), UpdatedContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = ByteCountToScan - ChunkingStats.BytesHashed.load(), + .RemainingCount = ByteCountToScan - LocalChunkingStats.BytesHashed.load(), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); - + ChunkingStats += LocalChunkingStats; FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (!AbortFlag) @@ -1955,33 +1959,34 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; LocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, OutLocalFolderContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), OutLocalFolderContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = (ByteCountToScan - ChunkingStats.BytesHashed.load()), + .RemainingCount = (ByteCountToScan - LocalChunkingStats.BytesHashed.load()), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); - + ChunkingStats += LocalChunkingStats; FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (AbortFlag) diff --git a/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h b/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h index a4f22f4df..eb6ba19aa 100644 --- a/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h +++ b/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h @@ -132,6 +132,18 @@ struct ChunkingStatistics std::atomic<uint64_t> UniqueSequencesFound = 0; std::atomic<uint64_t> UniqueBytesFound = 0; uint64_t ElapsedWallTimeUS = 0; + + inline ChunkingStatistics& operator+=(const ChunkingStatistics& Rhs) + { + FilesProcessed += Rhs.FilesProcessed; + FilesChunked += Rhs.FilesChunked; + BytesHashed += Rhs.BytesHashed; + UniqueChunksFound += Rhs.UniqueChunksFound; + UniqueSequencesFound += Rhs.UniqueSequencesFound; + UniqueBytesFound += Rhs.UniqueBytesFound; + ElapsedWallTimeUS += Rhs.ElapsedWallTimeUS; + return *this; + } }; ChunkedFolderContent ChunkFolderContent(ChunkingStatistics& Stats, |