diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-08-08 17:26:32 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-08-19 18:38:49 +0200 |
commit | 3846569e57062c7a6eb91483b88596349024165b (patch) | |
tree | 9f8d3a6d6815738a1d77bb22d1d05ad7bd14a915 /src | |
parent | 61ee4517214cd8547ba7088fb4a53ec543d986b2 (diff) | |
download | justbuild-3846569e57062c7a6eb91483b88596349024165b.tar.gz |
Progress: Print overall build progress in percent
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/progress_reporting/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/progress_reporting/base_progress_reporter.cpp | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/buildtool/progress_reporting/TARGETS b/src/buildtool/progress_reporting/TARGETS index acff7b61..c58be2d3 100644 --- a/src/buildtool/progress_reporting/TARGETS +++ b/src/buildtool/progress_reporting/TARGETS @@ -18,6 +18,7 @@ , "deps": [ ["src/buildtool/graph_traverser", "graph_traverser"] , ["src/buildtool/common", "common"] + , ["@", "gsl-lite", "", "gsl-lite"] , "progress" ] } diff --git a/src/buildtool/progress_reporting/base_progress_reporter.cpp b/src/buildtool/progress_reporting/base_progress_reporter.cpp index 02a6a162..449f1dde 100644 --- a/src/buildtool/progress_reporting/base_progress_reporter.cpp +++ b/src/buildtool/progress_reporting/base_progress_reporter.cpp @@ -4,6 +4,8 @@ #include <mutex> +#include <gsl-lite/gsl-lite.hpp> + #include "fmt/core.h" #include "src/buildtool/common/statistics.hpp" #include "src/buildtool/logging/logger.hpp" @@ -15,6 +17,7 @@ auto BaseProgressReporter::Reporter() -> GraphTraverser::progress_reporter_t { auto const& stats = Statistics::Instance(); std::unique_lock<std::mutex> lock(m); int64_t delay = kStartDelayMillis; + int total = gsl::narrow<int>(Progress::Instance().OriginMap().size()); while (not *done) { cv->wait_for(lock, std::chrono::milliseconds(delay)); if (not *done) { @@ -41,8 +44,10 @@ auto BaseProgressReporter::Reporter() -> GraphTraverser::progress_reporter_t { " ({}{})", sample, active > 1 ? ", ..." : ""); } } + constexpr int kOneHundred{100}; Logger::Log(LogLevel::Progress, - "{} cached, {} run, {} processing{}.", + "[{:3}%] {} cached, {} run, {} processing{}.", + (cached + run) * kOneHundred / total, cached, run, active, |