From 1e8066caaa711b9ab9f76b25873327779924fda6 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Mon, 22 Aug 2022 14:29:14 +0200 Subject: Progress percentage: only count actual work When reporting the percentage already completed, only report actions that were actually run. Cache hits are considered by reducing the overall work to be considered, i.e., by making the completed actions count more. In practice, however, most cache hits are discovered ayway till the first progress status is reported. --- src/buildtool/progress_reporting/base_progress_reporter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/buildtool/progress_reporting/base_progress_reporter.cpp b/src/buildtool/progress_reporting/base_progress_reporter.cpp index 449f1dde..563a4a00 100644 --- a/src/buildtool/progress_reporting/base_progress_reporter.cpp +++ b/src/buildtool/progress_reporting/base_progress_reporter.cpp @@ -45,9 +45,15 @@ auto BaseProgressReporter::Reporter() -> GraphTraverser::progress_reporter_t { } } constexpr int kOneHundred{100}; + int total_work = total - cached; + int progress = + kOneHundred; // default if no work has to be done + if (total_work > 0) { + progress = run * kOneHundred / total_work; + } Logger::Log(LogLevel::Progress, "[{:3}%] {} cached, {} run, {} processing{}.", - (cached + run) * kOneHundred / total, + progress, cached, run, active, -- cgit v1.2.3