summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-08-22 14:29:14 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2022-08-22 14:50:00 +0200
commit1e8066caaa711b9ab9f76b25873327779924fda6 (patch)
tree79aa761506424ca8f3debbe920a9af08422a5ef2
parent25e689a0b230169fd56b14596fbb9560015eb93a (diff)
downloadjustbuild-1e8066caaa711b9ab9f76b25873327779924fda6.tar.gz
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.
-rw-r--r--src/buildtool/progress_reporting/base_progress_reporter.cpp8
1 files changed, 7 insertions, 1 deletions
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,