From 0dc03d406a9958adb27ff49f568685f6e80f01ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Feb 2018 10:29:03 +0200 Subject: Add progress to dist meta-operation --- build2/operation.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'build2/operation.cxx') diff --git a/build2/operation.cxx b/build2/operation.cxx index eaacc6d..dabebcc 100644 --- a/build2/operation.cxx +++ b/build2/operation.cxx @@ -112,7 +112,7 @@ namespace build2 } void - match (const values&, action a, action_targets& ts, uint16_t diag) + match (const values&, action a, action_targets& ts, uint16_t diag, bool prog) { tracer trace ("match"); @@ -126,8 +126,8 @@ namespace build2 // string what; // Note: must outlive monitor_guard. scheduler::monitor_guard mg; - if (ops.progress () || - (stderr_term && verb >= 1 && verb <= 2 && !ops.no_progress ())) + + if (prog && show_progress (2 /* max_verb */)) { size_t incr (stderr_term ? 1 : 10); // Scale depending on output type. @@ -240,7 +240,8 @@ namespace build2 } void - execute (const values&, action a, action_targets& ts, uint16_t diag) + execute (const values&, action a, action_targets& ts, + uint16_t diag, bool prog) { tracer trace ("execute"); @@ -265,12 +266,10 @@ namespace build2 string what; // Note: must outlive monitor_guard. scheduler::monitor_guard mg; - if (ops.progress () || (stderr_term && verb == 1 && !ops.no_progress ())) + if (prog && show_progress (1 /* max_verb */)) { size_t init (target_count.load (memory_order_relaxed)); - size_t incr (init / 100); // 1%. - if (incr == 0) - incr = 1; + size_t incr (init > 100 ? init / 100 : 1); // 1%. if (init != incr) { @@ -476,7 +475,7 @@ namespace build2 } static void - info_execute (const values&, action, action_targets& ts, uint16_t) + info_execute (const values&, action, action_targets& ts, uint16_t, bool) { for (size_t i (0); i != ts.size (); ++i) { -- cgit v1.1