diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-19 09:58:09 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-19 10:23:48 +0100 |
commit | ff4ef1723619fb78c6eaf44c35138145f5af39ca (patch) | |
tree | b1399c830ba9441cb03153baa6732b932b086800 /src/other_tools/just_mr | |
parent | ad860684f6fc2e07a764049bd467718c1fef24cb (diff) | |
download | justbuild-ff4ef1723619fb78c6eaf44c35138145f5af39ca.tar.gz |
just-mr progress: consider computed roots as no-work
... as they will be taken care of only during the build.
Diffstat (limited to 'src/other_tools/just_mr')
-rw-r--r-- | src/other_tools/just_mr/progress_reporting/progress_reporter.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/just_mr/progress_reporting/statistics.hpp | 8 | ||||
-rw-r--r-- | src/other_tools/just_mr/setup.cpp | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp index 2ad17376..efff2fd7 100644 --- a/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp +++ b/src/other_tools/just_mr/progress_reporting/progress_reporter.cpp @@ -31,11 +31,15 @@ auto JustMRProgressReporter::Reporter( auto const total = progress->GetTotal(); auto const local = stats->LocalPathsCounter(); auto const cached = stats->CacheHitsCounter(); + auto const computed = stats->ComputedCounter(); auto const run = stats->ExecutedCounter(); auto const active = progress->TaskTracker().Active(); auto const sample = progress->TaskTracker().Sample(); - auto msg = - fmt::format("{} local, {} cached, {} done", local, cached, run); + auto msg = fmt::format("{} comptued, {} local, {} cached, {} done", + computed, + local, + cached, + run); if ((active > 0) and not sample.empty()) { msg = fmt::format("{}; {} fetches ({}{})", msg, @@ -45,7 +49,7 @@ auto JustMRProgressReporter::Reporter( } constexpr int kOneHundred{100}; int progress = kOneHundred; // default if no work has to be done - if (auto const noops = cached + local; noops < total) { + if (auto const noops = cached + local + computed; noops < total) { progress = static_cast<int>(run * kOneHundred / (total - noops)); } Logger::Log(LogLevel::Progress, "[{:3}%] {}", progress, msg); diff --git a/src/other_tools/just_mr/progress_reporting/statistics.hpp b/src/other_tools/just_mr/progress_reporting/statistics.hpp index dc5cd181..20a39990 100644 --- a/src/other_tools/just_mr/progress_reporting/statistics.hpp +++ b/src/other_tools/just_mr/progress_reporting/statistics.hpp @@ -22,6 +22,7 @@ class JustMRStatistics final { public: void IncrementLocalPathsCounter() noexcept { ++num_local_paths_; } void IncrementCacheHitsCounter() noexcept { ++num_cache_hits_; } + void IncrementComputedCounter() noexcept { ++num_computed_; } void IncrementExecutedCounter() noexcept { ++num_executed_; } [[nodiscard]] auto LocalPathsCounter() const noexcept -> size_t { @@ -30,6 +31,9 @@ class JustMRStatistics final { [[nodiscard]] auto CacheHitsCounter() const noexcept -> size_t { return num_cache_hits_; } + [[nodiscard]] auto ComputedCounter() const noexcept -> size_t { + return num_computed_; + } [[nodiscard]] auto ExecutedCounter() const noexcept -> size_t { return num_executed_; } @@ -37,7 +41,9 @@ class JustMRStatistics final { private: std::atomic<std::size_t> num_local_paths_ = 0; // roots that are real paths std::atomic<std::size_t> num_cache_hits_ = 0; // no-ops - std::atomic<std::size_t> num_executed_ = 0; // actual work done + std::atomic<std::size_t> num_computed_ = + 0; // no work to be done, as it is computed + std::atomic<std::size_t> num_executed_ = 0; // actual work done }; #endif // INCLUDED_SRC_OTHER_TOOLS_JUST_MR_PROGRESS_REPORTING_STATISTICS_HPP diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp index 9ba02fa7..57ed0fd9 100644 --- a/src/other_tools/just_mr/setup.cpp +++ b/src/other_tools/just_mr/setup.cpp @@ -141,7 +141,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config, JustMR::Utils::ReachableRepositories(repos, *main, setup_repos); } Logger::Log(LogLevel::Info, - "Found {} repositories to set up", + "Found {} repositories involved", setup_repos->to_setup.size()); // setup local execution config |